๐ข Organization Service
The Organization Service manages the lifecycle and retrieval of organizations within the system. It supports full CRUD functionality, lookup by various identifiers, and pagination.
๐งพ Organization Structureโ
Organization Fieldsโ
| Field | Type | Description |
|---|---|---|
id | uint32 | Unique identifier for the organization |
name | string | Name of the organization |
owner | uint32 | User ID of the owner |
slug | string | Unique slug/handle for URL usage |
pan | string | PAN (Permanent Account Number) or business ID |
zoho_customer_id | string | External Zoho CRM identifier |
logo | string | URL or path to organization logo |
created_at | timestamp | Creation timestamp |
updated_at | timestamp | Last modification timestamp |
created_by | uint32 | ID of user who created this record |
updated_by | uint32 | ID of user who last modified the record |
is_active | bool | Whether the organization is currently active |
๐ Servicesโ
OrganizationServiceโ
| RPC Method | Request Type | Response Type | Description |
|---|---|---|---|
CreateOrganization | CreateOrganizationRequest | OrganizationResponse | Creates a new organization |
UpdateOrganization | UpdateOrganizationRequest | OrganizationResponse | Updates an existing organization |
ActivateOrganization | ActivateOrganizationRequest | CheckResponse | Marks an organization as active |
DeactivateOrganization | DeactivateOrganizationRequest | CheckResponse | Marks an organization as inactive |
GetOrganizationByID | GetOrganizationRequest | OrganizationResponse | Fetches an organization by its ID |
GetOrganizationBySlug | GetOrganizationBySlugRequest | OrganizationResponse | Fetches an organization by its slug |
GetOrganizationByPan | GetOrganizationByPanRequest | OrganizationResponse | Fetches an organization by PAN |
ListAllOrganizations | ListOrganizationRequest | OrganizationResponse | Lists all organizations with pagination and search |
๐ฆ Go Models Overviewโ
models.Organizationโ
Represents the organization entity in the database using GORM.
| Field | Type | Notes |
|---|---|---|
ID | uint32 | Auto-incremented primary key |
Name | string | Unique organization name |
Owner | uint32 | Owner user ID |
Slug | string | Unique, URL-safe identifier |
PAN | string | Permanent Account Number or tax identifier |
ZohoCustomerID | string | External reference to Zoho CRM |
Logo | string | URL or path to logo |
CreatedAt | time.Time | Auto-managed creation timestamp |
UpdatedAt | time.Time | Auto-managed update timestamp |
CreatedBy | uint32 | User ID who created it |
UpdatedBy | uint32 | Last editor user ID |
IsActive | bool | Indicates if active/inactive |
models.ClientsOrganizationโ
Used for internal client-facing operations or legacy sync tables. Maps to the clients_organization table.
| Field | Type | Description |
|---|---|---|
ID | uint | Primary key |
Name | string | Organization name |
Created | time.Time | Record creation timestamp |
Modified | time.Time | Record last modification timestamp |
IsActive | bool | Status flag |
BillingStatus | string | Internal billing status |
Slug | string | URL-safe handle |
Description | string | Long-form description |
CreatedAt | time.Time | Record created time (redundant legacy) |
UpdatedAt | time.Time | Last updated time |
โ Note: This struct is mapped manually using
.TableName()to theclients_organizationtable and may be used for syncing or reporting.
๐ Query Optionsโ
Pagination & Filteringโ
page_number: Page index (starting from 1)page_size: Number of results per pagesearch: Optional keyword to filter organization names or slugs
๐ก Response Structuresโ
OrganizationResponseโ
Used in listing and retrieval APIs.
{
"message": "string",
"code": "string",
"data": [
/* array of Organization */
],
"total": 100
}
CheckResponseโ
Generic status for update/activate/deactivate actions.
{
"message": "Operation successful",
"code": "200",
"check": true
}