Company Microservice
This microservice handles the creation, management, and querying of company data. It includes a Go data model for persistence and a Protocol Buffers definition for gRPC-based operations.
Company Model (company.go)
The Company struct defines the data structure for a company record:
| Field | Type | Description |
|---|---|---|
ID | uint32 | Unique identifier for the company (auto-incremented) |
Name | string | Company name (minimum 2 characters required) |
Owner | uint32 | ID of the company owner (required) |
OrgID | uint32 | Organization ID the company is linked to (required) |
Logo | string | URL or path to the company logo |
Slug | string | Unique slug/identifier for the company |
PAN | string | Permanent Account Number (must be unique) |
Address | string | Company address (text format) |
IsActive | bool | Status indicating if the company is active |
CreatedAt | time.Time | Timestamp when the record was created |
UpdatedAt | time.Time | Timestamp when the record was last updated |
CreatedBy | uint32 | ID of the user who created the record |
UpdatedBy | uint32 | ID of the user who last updated the record |
gRPC Service (company.proto)
The Protocol Buffers file defines the service interface and messages used for communication.
Messages
Company: Reflects the fields of the GoCompanymodel.CompanyId: Request message containing a company ID.CompanyList: Response with a list ofCompanyobjects.CompanyRequest: Used to create or update a company.CompanyResponse: Contains a singleCompanyobject in response.Empty: Used when no input or output is required.
Services
CreateCompany(CompanyRequest) returns (CompanyResponse)GetCompany(CompanyId) returns (CompanyResponse)ListCompanies(Empty) returns (CompanyList)UpdateCompany(CompanyRequest) returns (CompanyResponse)DeleteCompany(CompanyId) returns (Empty)
These gRPC endpoints support standard CRUD operations for managing company records.