Skip to main content

Module Microservice

The Module microservice manages modules within applications. It provides CRUD operations, activation/deactivation, and filtering of modules by application and name. Each module typically represents a functional unit in a larger system.


Model (models.go)

Module

Represents a distinct module that is part of an application.

FieldTypeDescription
IDuint32Auto-increment primary key
AppIDuint32ID of the application this module belongs to
NamestringName of the module
UrlstringURL path or endpoint for the module
VersionstringVersion identifier (e.g., "v1.0.0")
IsActiveboolIndicates if the module is active
Actions[]stringList of allowed actions in the module
CreatedAttime.TimeModule creation timestamp
UpdatedAttime.TimeLast update timestamp
CreatedByuint32ID of the user who created the record
UpdatedByuint32ID of the user who last updated the record

Note: The Actions field uses pq.StringArray to store a string array in PostgreSQL.


gRPC API (module.proto)

Messages

Module

Represents the structure of a module used throughout requests and responses.

Requests

  • CreateModuleRequest – Adds a new module.
  • UpdateModuleRequest – Modifies an existing module.
  • ActivateModuleRequest – Marks a module as active.
  • DeactivateModuleRequest – Marks a module as inactive.
  • GetModuleByIDRequest – Fetches a module by its unique ID.
  • GetModuleByNameRequest – Retrieves a module by name.
  • ListModulesByAppIDRequest – Lists all modules under a specific application ID.
  • ListAllModulesRequest – Lists all modules in the system with pagination and search.

Responses

  • ModuleResponse – Standard response with a list of modules and metadata.
  • CheckResponse – A boolean confirmation response (e.g., for activation/deactivation).

Services

service ModuleService {
rpc CreateModule(CreateModuleRequest) returns (ModuleResponse);
rpc UpdateModule(UpdateModuleRequest) returns (ModuleResponse);
rpc ActivateModule(ActivateModuleRequest) returns (CheckResponse);
rpc DeactivateModule(DeactivateModuleRequest) returns (CheckResponse);
rpc GetModuleByID(GetModuleByIDRequest) returns (ModuleResponse);
rpc GetModuleByName(GetModuleByNameRequest) returns (ModuleResponse);
rpc ListModulesByAppID(ListModulesByAppIDRequest) returns (ModuleResponse);
rpc ListAllModules(ListAllModulesRequest) returns (ModuleResponse);
}

Pagination & Filtering

  • All list RPCs accept page_number and page_size for pagination.
  • Search filtering is supported via the search field in list requests.