Skip to main content

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:

FieldTypeDescription
IDuint32Unique identifier for the company (auto-incremented)
NamestringCompany name (minimum 2 characters required)
Owneruint32ID of the company owner (required)
OrgIDuint32Organization ID the company is linked to (required)
LogostringURL or path to the company logo
SlugstringUnique slug/identifier for the company
PANstringPermanent Account Number (must be unique)
AddressstringCompany address (text format)
IsActiveboolStatus indicating if the company is active
CreatedAttime.TimeTimestamp when the record was created
UpdatedAttime.TimeTimestamp when the record was last updated
CreatedByuint32ID of the user who created the record
UpdatedByuint32ID 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 Go Company model.
  • CompanyId: Request message containing a company ID.
  • CompanyList: Response with a list of Company objects.
  • CompanyRequest: Used to create or update a company.
  • CompanyResponse: Contains a single Company object 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.