Skip to main content

๐Ÿข 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โ€‹

FieldTypeDescription
iduint32Unique identifier for the organization
namestringName of the organization
owneruint32User ID of the owner
slugstringUnique slug/handle for URL usage
panstringPAN (Permanent Account Number) or business ID
zoho_customer_idstringExternal Zoho CRM identifier
logostringURL or path to organization logo
created_attimestampCreation timestamp
updated_attimestampLast modification timestamp
created_byuint32ID of user who created this record
updated_byuint32ID of user who last modified the record
is_activeboolWhether the organization is currently active

๐Ÿš€ Servicesโ€‹

OrganizationServiceโ€‹

RPC MethodRequest TypeResponse TypeDescription
CreateOrganizationCreateOrganizationRequestOrganizationResponseCreates a new organization
UpdateOrganizationUpdateOrganizationRequestOrganizationResponseUpdates an existing organization
ActivateOrganizationActivateOrganizationRequestCheckResponseMarks an organization as active
DeactivateOrganizationDeactivateOrganizationRequestCheckResponseMarks an organization as inactive
GetOrganizationByIDGetOrganizationRequestOrganizationResponseFetches an organization by its ID
GetOrganizationBySlugGetOrganizationBySlugRequestOrganizationResponseFetches an organization by its slug
GetOrganizationByPanGetOrganizationByPanRequestOrganizationResponseFetches an organization by PAN
ListAllOrganizationsListOrganizationRequestOrganizationResponseLists all organizations with pagination and search

๐Ÿ“ฆ Go Models Overviewโ€‹

models.Organizationโ€‹

Represents the organization entity in the database using GORM.

FieldTypeNotes
IDuint32Auto-incremented primary key
NamestringUnique organization name
Owneruint32Owner user ID
SlugstringUnique, URL-safe identifier
PANstringPermanent Account Number or tax identifier
ZohoCustomerIDstringExternal reference to Zoho CRM
LogostringURL or path to logo
CreatedAttime.TimeAuto-managed creation timestamp
UpdatedAttime.TimeAuto-managed update timestamp
CreatedByuint32User ID who created it
UpdatedByuint32Last editor user ID
IsActiveboolIndicates if active/inactive

models.ClientsOrganizationโ€‹

Used for internal client-facing operations or legacy sync tables. Maps to the clients_organization table.

FieldTypeDescription
IDuintPrimary key
NamestringOrganization name
Createdtime.TimeRecord creation timestamp
Modifiedtime.TimeRecord last modification timestamp
IsActiveboolStatus flag
BillingStatusstringInternal billing status
SlugstringURL-safe handle
DescriptionstringLong-form description
CreatedAttime.TimeRecord created time (redundant legacy)
UpdatedAttime.TimeLast updated time

โœ… Note: This struct is mapped manually using .TableName() to the clients_organization table 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 page
  • search: 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
}