Skip to main content

Department Microservice

The Department microservice manages organizational departments. It provides a data model for persistent storage and a gRPC interface to perform CRUD operations.

Model (department.go)

Department

Represents a department within an organization.

FieldTypeDescription
IDuint32Unique identifier for the department (auto-incremented)
NamestringName of the department (minimum 2 characters)
OrgIDuint32ID of the organization to which the department belongs
CreatedAttime.TimeTimestamp of when the department was created
UpdatedAttime.TimeTimestamp of the last update
CreatedByuint32ID of the user who created the department
UpdatedByuint32ID of the user who last updated the department

gRPC Service (department.proto)

This Protocol Buffers file defines the service for managing departments via gRPC.

Messages

  • Department: Mirrors the Go model fields.
  • DepartmentId: Request message containing a department ID.
  • DepartmentList: Response message containing a list of departments.
  • DepartmentRequest: Used for creating or updating a department.
  • DepartmentResponse: Returns a single department.
  • Empty: Used where no input/output is needed.

Services

  • CreateDepartment(DepartmentRequest) returns (DepartmentResponse)
  • GetDepartment(DepartmentId) returns (DepartmentResponse)
  • ListDepartments(Empty) returns (DepartmentList)
  • UpdateDepartment(DepartmentRequest) returns (DepartmentResponse)
  • DeleteDepartment(DepartmentId) returns (Empty)

These gRPC services enable full management of department records in the system.