openapi: 3.1.0 info: title: Api version: 0.1.0 description: Bangladesh PWD Estimate Software API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication operations - name: sor description: Schedule of Rates operations - name: projects description: Project operations - name: estimates description: Estimate operations - name: estimate-items description: Estimate line item operations - name: dashboard description: Dashboard summary operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/register: post: operationId: register tags: [auth] summary: Register a new organization and admin user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/login: post: operationId: login tags: [auth] summary: Login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginInput" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Get current authenticated user responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/UserProfile" "401": description: Unauthorized content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /sor: get: operationId: listSorItems tags: [sor] summary: List Schedule of Rates items parameters: - name: search in: query schema: type: string - name: category in: query schema: type: string - name: discipline in: query schema: type: string - name: subCategory in: query schema: type: string - name: chapter in: query schema: type: string - name: sorVersion in: query schema: type: string - name: visibleOnly in: query schema: type: boolean - name: page in: query schema: type: integer - name: limit in: query schema: type: integer responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SorItemList" /sor/categories: get: operationId: listSorCategories tags: [sor] summary: List all SOR categories responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/SorCategory" /sor/filters: get: operationId: getSorFilters tags: [sor] summary: List SOR filter metadata responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SorFilters" /sor/{id}: get: operationId: getSorItem tags: [sor] summary: Get a single SOR item parameters: - name: id in: path required: true schema: type: integer responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SorItem" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /projects: get: operationId: listProjects tags: [projects] summary: List all projects for the current organization responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/Project" post: operationId: createProject tags: [projects] summary: Create a new project requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProjectInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Project" /projects/{id}: get: operationId: getProject tags: [projects] summary: Get a project parameters: - name: id in: path required: true schema: type: integer responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/Project" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" patch: operationId: updateProject tags: [projects] summary: Update a project parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProjectUpdate" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/Project" delete: operationId: deleteProject tags: [projects] summary: Delete a project parameters: - name: id in: path required: true schema: type: integer responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /projects/{projectId}/estimates: get: operationId: listEstimates tags: [estimates] summary: List estimates for a project parameters: - name: projectId in: path required: true schema: type: integer responses: "200": description: OK content: application/json: schema: type: array items: $ref: "#/components/schemas/Estimate" post: operationId: createEstimate tags: [estimates] summary: Create an estimate for a project parameters: - name: projectId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EstimateInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/Estimate" /estimates/{id}: get: operationId: getEstimate tags: [estimates] summary: Get an estimate with all its line items parameters: - name: id in: path required: true schema: type: integer responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/EstimateDetail" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" patch: operationId: updateEstimate tags: [estimates] summary: Update an estimate parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EstimateUpdate" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/Estimate" delete: operationId: deleteEstimate tags: [estimates] summary: Delete an estimate parameters: - name: id in: path required: true schema: type: integer responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /estimates/{estimateId}/items: post: operationId: addEstimateItem tags: [estimate-items] summary: Add a SOR item to an estimate parameters: - name: estimateId in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EstimateItemInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/EstimateItem" /estimate-items/{id}: patch: operationId: updateEstimateItem tags: [estimate-items] summary: Update an estimate line item parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EstimateItemUpdate" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/EstimateItem" delete: operationId: deleteEstimateItem tags: [estimate-items] summary: Delete an estimate line item parameters: - name: id in: path required: true schema: type: integer responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /dashboard: get: operationId: getDashboard tags: [dashboard] summary: Get dashboard summary statistics responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" components: schemas: HealthStatus: type: object properties: status: type: string required: [status] ErrorResponse: type: object properties: error: type: string required: [error] SuccessResponse: type: object properties: success: type: boolean required: [success] RegisterInput: type: object required: [orgName, name, email, password] properties: orgName: type: string minLength: 2 name: type: string minLength: 2 email: type: string password: type: string minLength: 6 designation: type: string officeName: type: string LoginInput: type: object required: [email, password] properties: email: type: string password: type: string AuthResponse: type: object required: [token, user] properties: token: type: string user: $ref: "#/components/schemas/UserProfile" UserProfile: type: object required: [id, name, email, orgId, orgName, role] properties: id: type: integer name: type: string email: type: string orgId: type: integer orgName: type: string role: type: string SorItem: type: object required: [id, code, description, category] properties: id: type: integer code: type: string description: type: string unit: type: ["string", "null"] rate: type: ["number", "null"] rateCtgSyl: type: ["number", "null"] rateKhuBarGop: type: ["number", "null"] rateRajRan: type: ["number", "null"] category: type: string chapter: type: ["string", "null"] subCategory: type: ["string", "null"] discipline: type: ["string", "null"] sorVersion: type: string editedDescription: type: ["string", "null"] status: type: ["string", "null"] isActive: type: boolean isVisible: type: boolean parentOverride: type: ["string", "null"] remarks: type: ["string", "null"] SorItemList: type: object required: [items, total, page, limit] properties: items: type: array items: $ref: "#/components/schemas/SorItem" total: type: integer page: type: integer limit: type: integer SorCategory: type: object required: [name, count] properties: name: type: string count: type: integer SorLocation: type: object required: [id, zoneName, districtName, upazilaName, multiplier, rateColumn] properties: id: type: integer zoneName: type: string districtName: type: string upazilaName: type: string multiplier: type: number rateColumn: type: string SorFilters: type: object required: [disciplines, categories, subCategories, chapters, versions, locations] properties: disciplines: type: array items: $ref: "#/components/schemas/SorCategory" categories: type: array items: $ref: "#/components/schemas/SorCategory" subCategories: type: array items: $ref: "#/components/schemas/SorCategory" chapters: type: array items: $ref: "#/components/schemas/SorCategory" versions: type: array items: $ref: "#/components/schemas/SorCategory" locations: type: array items: $ref: "#/components/schemas/SorLocation" Project: type: object required: [id, name, orgId, createdAt] properties: id: type: integer name: type: string location: type: ["string", "null"] clientName: type: ["string", "null"] description: type: ["string", "null"] status: type: string orgId: type: integer estimateCount: type: integer totalValue: type: number createdAt: type: string updatedAt: type: string ProjectInput: type: object required: [name] properties: name: type: string minLength: 2 location: type: string clientName: type: string description: type: string status: type: string ProjectUpdate: type: object properties: name: type: string location: type: string clientName: type: string description: type: string status: type: string Estimate: type: object required: [id, name, projectId, status, createdAt] properties: id: type: integer name: type: string projectId: type: integer description: type: ["string", "null"] status: type: string totalAmount: type: number itemCount: type: integer createdAt: type: string updatedAt: type: string EstimateInput: type: object required: [name] properties: name: type: string minLength: 2 description: type: string EstimateUpdate: type: object properties: name: type: string description: type: string status: type: string EstimateItem: type: object required: [id, estimateId, sorItemId, quantity, rate, amount] properties: id: type: integer estimateId: type: integer sorItemId: type: integer sorCode: type: string description: type: string unit: type: string quantity: type: number rate: type: number amount: type: number remarks: type: ["string", "null"] slNo: type: integer EstimateItemInput: type: object required: [sorItemId, quantity] properties: sorItemId: type: integer quantity: type: number rate: type: number remarks: type: string EstimateItemUpdate: type: object properties: quantity: type: number rate: type: number remarks: type: string EstimateDetail: type: object required: [id, name, projectId, status, items, totalAmount, createdAt] properties: id: type: integer name: type: string projectId: type: integer projectName: type: string description: type: ["string", "null"] status: type: string items: type: array items: $ref: "#/components/schemas/EstimateItem" totalAmount: type: number createdAt: type: string updatedAt: type: string DashboardSummary: type: object required: [totalProjects, totalEstimates, totalValue, recentProjects] properties: totalProjects: type: integer totalEstimates: type: integer totalValue: type: number activeProjects: type: integer recentProjects: type: array items: $ref: "#/components/schemas/Project" topEstimates: type: array items: $ref: "#/components/schemas/Estimate"