Technical Specification: Company Setup
1. Feature Overview
-
Module: Settings
-
Feature Name: Company Setup
-
Description: This module allows administrators to create, update, and manage company entities within the system. It acts as a master data management tool for companies, supporting internal and external entity definitions.
-
User Guide Reference: [Ekajaya Admin User Guide - Setting Module, Page 3]
2. Functional Workflow (User Perspective)
UI Input Fields
| Field Name | Type | Required? | Description |
| Company Name | Text | Yes | Must be unique in the system. |
| Description | Text | No | Optional details about the company. |
| Remark | Text | No | Optional internal remarks. |
| Is Internal? | Checkbox | No | Marks the company as an internal entity. |
3. Technical Implementation
A. Permissions & Access Control
The following permission codes are required to access specific functionalities. These checks are implemented via PermissionGuard and template *ngIf directives.
| Scope | Permission Code | Description |
| Menu Visibility | COMPANY.MENU |
Shows "Company" in the side navigation. |
| Page Access | COMPANY.LISTING |
Grants access to /listing-company. |
| Create Action | COMPANY.CREATE |
Shows the + Add button. |
| View/Edit Access | COMPANY.VIEW |
Grants access to /add-company-manage (Read/Edit). |
| Update Action | COMPANY.UPDATE |
Allows saving changes on the Edit screen. |
| Delete Action | COMPANY.DELETE |
Shows the Delete (Trash) icon. |
B. API Interaction
Base URL: ${environment.baseApiUrl}
1. Retrieve Company List (Pagination & Search)
-
Endpoint:
/companies/getQuery -
Method:
POST -
Query Params:
-
page: (Number) Page index. -
limit: (Number) Records per page (default 25). -
select:id,companyName,description,remark,isDeleted -
sort:companyName -
filter:isDeleted||$eq||0(plus dynamic search filters for name/description).
-
2. Get Single Company (For Edit)
-
Endpoint:
/companies/getOne -
Method:
GET -
Query Params:
id(Number)
3. Create Company
-
Endpoint:
/companies/create -
Method:
POST -
Payload:
JSON{ "companyName": "String", "description": "String", "remark": "String", "isInternal": Boolean }
4. Update Company
-
Endpoint:
/companies/update -
Method:
POST -
Payload: Same as Create, but includes
"id": Number.
5. Delete Company (Soft Delete)
-
Endpoint:
/companies/update -
Method:
POST -
Logic: Updates the record by setting
isDeleted: true. -
Payload:
JSON{ "id": Number, "isDeleted": true }
C. Validation & Business Logic
1. Unique Name Validation
-
Trigger: On Save (Create Mode only).
-
Logic: Frontend calls
/companies/getQuerywith filtercompanyName||$eq||{InputName};isDeleted||$eq||0. -
Condition: If
resultCount > 0, blocking error: "Company name already exists".
2. Pre-Delete Dependency Checks
Before allowing a delete, the system checks if the company is tied to active records in other modules. If any check returns data, the delete is blocked.
| Check Order | Module | Endpoint | Filter Logic |
| 1 | Users | /companyUsers/getQuery |
`companyId |
| 2 | Drivers | /drivers/getQuery |
`companyId |
| 3 | Movers | /movers/getQuery |
`companyId |
| 4 | Tankers | /tankers/getQuery |
`companyId |