fix build

This commit is contained in:
2026-04-15 04:59:05 +03:00
parent 020ffccfd6
commit 973149e974
28 changed files with 2352 additions and 89 deletions
+85 -17
View File
@@ -19740,17 +19740,61 @@
"schema": {
"type": "object",
"properties": {
"services_status": {
"type": "string"
"estimate_services": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"status": {
"type": "string"
}
}
}
},
"parts_status": {
"type": "string"
"estimate_parts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"status": {
"type": "string"
}
}
}
},
"inspections_status": {
"type": "string"
"estimate_inspections": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"status": {
"type": "string"
}
}
}
},
"expense_items_status": {
"type": "string"
"estimate_expense_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"status": {
"type": "string"
}
}
}
},
"authorisation_method": {
"type": "string"
@@ -19761,10 +19805,34 @@
}
},
"example": {
"services_status": "accepted",
"parts_status": "accepted",
"inspections_status": "accepted",
"expense_items_status": "accepted",
"estimate_services": [
{
"id": 11,
"status": "accepted"
},
{
"id": 12,
"status": "rejected"
}
],
"estimate_parts": [
{
"id": 21,
"status": "accepted"
}
],
"estimate_inspections": [
{
"id": 31,
"status": "pending"
}
],
"estimate_expense_items": [
{
"id": 41,
"status": "accepted"
}
],
"authorisation_method": "in_person",
"employee_id": 1
}
@@ -19851,15 +19919,15 @@
"authorisation_date": "2026-04-13",
"authorisation_time": "14:30:00",
"authorisation_method": "in_person",
"total_accepted": 8
"total_accepted": 5
},
"updated_counts": {
"services": 3,
"parts": 2,
"services": 2,
"parts": 1,
"inspections": 1,
"expense_items": 2
"expense_items": 1
},
"histories_count": 9
"histories_count": 6
}
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "90943e73-b99e-468b-b10b-d3a02f751da9",
"_postman_id": "351b2d30-cb82-4904-9a47-0d356181a8ea",
"name": "Reparee Collection",
"description": "Auto-generated from OpenAPI spec. Import storage/app/openapi-default.json for the full schema.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
@@ -13384,7 +13384,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"services_status\": \"accepted\",\n \"parts_status\": \"accepted\",\n \"inspections_status\": \"accepted\",\n \"expense_items_status\": \"accepted\",\n \"authorisation_method\": \"in_person\",\n \"employee_id\": 1\n}",
"raw": "{\n \"estimate_services\": [\n {\n \"id\": 11,\n \"status\": \"accepted\"\n },\n {\n \"id\": 12,\n \"status\": \"rejected\"\n }\n ],\n \"estimate_parts\": [\n {\n \"id\": 21,\n \"status\": \"accepted\"\n }\n ],\n \"estimate_inspections\": [\n {\n \"id\": 31,\n \"status\": \"pending\"\n }\n ],\n \"estimate_expense_items\": [\n {\n \"id\": 41,\n \"status\": \"accepted\"\n }\n ],\n \"authorisation_method\": \"in_person\",\n \"employee_id\": 1\n}",
"options": {
"raw": {
"language": "json"
@@ -13431,7 +13431,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"services_status\": \"accepted\",\n \"parts_status\": \"accepted\",\n \"inspections_status\": \"accepted\",\n \"expense_items_status\": \"accepted\",\n \"authorisation_method\": \"in_person\",\n \"employee_id\": 1\n}",
"raw": "{\n \"estimate_services\": [\n {\n \"id\": 11,\n \"status\": \"accepted\"\n },\n {\n \"id\": 12,\n \"status\": \"rejected\"\n }\n ],\n \"estimate_parts\": [\n {\n \"id\": 21,\n \"status\": \"accepted\"\n }\n ],\n \"estimate_inspections\": [\n {\n \"id\": 31,\n \"status\": \"pending\"\n }\n ],\n \"estimate_expense_items\": [\n {\n \"id\": 41,\n \"status\": \"accepted\"\n }\n ],\n \"authorisation_method\": \"in_person\",\n \"employee_id\": 1\n}",
"options": {
"raw": {
"language": "json"
@@ -13461,7 +13461,7 @@
}
],
"cookie": [],
"body": "{\n \"message\": \"Estimate authorisation stored successfully\",\n \"data\": {\n \"estimate\": {\n \"id\": 1,\n \"is_authorisation\": true,\n \"authorisation_date\": \"2026-04-13\",\n \"authorisation_time\": \"14:30:00\",\n \"authorisation_method\": \"in_person\",\n \"total_accepted\": 8\n },\n \"updated_counts\": {\n \"services\": 3,\n \"parts\": 2,\n \"inspections\": 1,\n \"expense_items\": 2\n },\n \"histories_count\": 9\n }\n}"
"body": "{\n \"message\": \"Estimate authorisation stored successfully\",\n \"data\": {\n \"estimate\": {\n \"id\": 1,\n \"is_authorisation\": true,\n \"authorisation_date\": \"2026-04-13\",\n \"authorisation_time\": \"14:30:00\",\n \"authorisation_method\": \"in_person\",\n \"total_accepted\": 5\n },\n \"updated_counts\": {\n \"services\": 2,\n \"parts\": 1,\n \"inspections\": 1,\n \"expense_items\": 1\n },\n \"histories_count\": 6\n }\n}"
}
]
},
+2
View File
@@ -56,6 +56,7 @@ import { ConfigurationsClient } from "./clients/configurations"
import { AutoGenerateClient } from "./clients/auto-generate"
import { ExpenseItemsClient } from "./clients/expense-items"
import { InventoryCategoriesClient } from "./clients/inventory-categories"
import { DocumentPrintClient } from "./clients/document-print"
export function createApi(options?: ApiClientOptions) {
return {
@@ -116,6 +117,7 @@ export function createApi(options?: ApiClientOptions) {
autoGenerate: new AutoGenerateClient(undefined, options),
expenseItems: new ExpenseItemsClient(undefined, options),
inventoryCategories: new InventoryCategoriesClient(undefined, options),
documentPrint: new DocumentPrintClient(undefined, options),
}
}
@@ -0,0 +1,23 @@
import { ApiClient, type ApiClientOptions } from "../infra/client"
import type { ApiPath } from "../infra/types"
export const DOCUMENT_PRINT_ROUTES = {
INDEX: "/api/document-print",
} as const satisfies Record<string, ApiPath>
export type DocumentPrintType = "job_card" | "invoice" | "estimate" | "purchase_order" | "bill" | string
export type DocumentPrintMode = "print" | "download"
export class DocumentPrintClient extends ApiClient {
constructor(baseUrl?: string, defaultOptions?: ApiClientOptions) {
super(baseUrl, defaultOptions)
}
async print(type: DocumentPrintType, id: number | string, mode: DocumentPrintMode = "print"): Promise<Blob> {
return this.fetchBlob(DOCUMENT_PRINT_ROUTES.INDEX, {
method: "POST",
body: { type, id: Number(id), mode },
})
}
}
+70
View File
@@ -5,6 +5,13 @@ import type { ApiPath } from "../infra/types"
export const ESTIMATE_ROUTES = {
INDEX: "/api/estimates",
BY_ID: "/api/estimates/{id}",
SERVICES: "/api/estimate/{id}/services",
SERVICE_BY_ID: "/api/estimate/{id}/services/{service_id}",
PARTS: "/api/estimate/{id}/parts",
PART_BY_ID: "/api/estimate/{id}/parts/{part_id}",
EXPENSE_ITEMS: "/api/estimate/{id}/expense-items",
EXPENSE_ITEM_BY_ID: "/api/estimate/{id}/expense-items/{expense_item_id}",
STORE_AUTHORISATION: "/api/estimates/{id}/store-authorisation",
} as const satisfies Record<string, ApiPath>
export class EstimatesClient extends CrudClient<
@@ -21,4 +28,67 @@ export class EstimatesClient extends CrudClient<
const data = await this.get(ESTIMATE_ROUTES.INDEX, { query: { id } } as never)
return {...data, data: (data as any)?.data?.[0] ?? null }
}
// ── Estimate Services ──
async listServices(estimateId: string) {
return this.get(ESTIMATE_ROUTES.SERVICES, { params: { id: estimateId } } as never)
}
async addService(estimateId: string, payload: { service_id?: number; rate_type?: string; quantity?: number; rate?: string; description?: string; labor_rate_id?: number; working_hours?: string | number; labor_hours?: string | number; tax?: string; chart_of_account?: string; department_id?: number }) {
return this.post(ESTIMATE_ROUTES.SERVICES, payload as never, { params: { id: estimateId } } as never)
}
async updateService(estimateId: string, serviceId: string, payload: { rate?: string; quantity?: number }) {
return this.put(ESTIMATE_ROUTES.SERVICE_BY_ID, payload as never, { params: { id: estimateId, service_id: serviceId } } as never)
}
async removeService(estimateId: string, serviceId: string) {
return this.delete(ESTIMATE_ROUTES.SERVICE_BY_ID, { params: { id: estimateId, service_id: serviceId } } as never)
}
// ── Estimate Parts ──
async listParts(estimateId: string) {
return this.get(ESTIMATE_ROUTES.PARTS, { params: { id: estimateId } } as never)
}
async addPart(estimateId: string, payload: { part_id?: number; quantity?: number; rate?: string; description?: string }) {
return this.post(ESTIMATE_ROUTES.PARTS, payload as never, { params: { id: estimateId } } as never)
}
async updatePart(estimateId: string, partId: string, payload: { quantity?: number }) {
return this.put(ESTIMATE_ROUTES.PART_BY_ID, payload as never, { params: { id: estimateId, part_id: partId } } as never)
}
async removePart(estimateId: string, partId: string) {
return this.delete(ESTIMATE_ROUTES.PART_BY_ID, { params: { id: estimateId, part_id: partId } } as never)
}
// ── Estimate Expense Items ──
async listExpenseItems(estimateId: string) {
return this.get(ESTIMATE_ROUTES.EXPENSE_ITEMS, { params: { id: estimateId } } as never)
}
async addExpenseItem(estimateId: string, payload: { expense_item_id?: number; quantity?: number; rate?: string; description?: string }) {
return this.post(ESTIMATE_ROUTES.EXPENSE_ITEMS, payload as never, { params: { id: estimateId } } as never)
}
async updateExpenseItem(estimateId: string, expenseItemId: string, payload: { quantity?: number }) {
return this.put(ESTIMATE_ROUTES.EXPENSE_ITEM_BY_ID, payload as never, { params: { id: estimateId, expense_item_id: expenseItemId } } as never)
}
async removeExpenseItem(estimateId: string, expenseItemId: string) {
return this.delete(ESTIMATE_ROUTES.EXPENSE_ITEM_BY_ID, { params: { id: estimateId, expense_item_id: expenseItemId } } as never)
}
// ── Authorisation ──
async storeAuthorisation(estimateId: string, payload: {
estimate_services?: { id: number; status: string }[]
estimate_parts?: { id: number; status: string }[]
estimate_inspections?: { id: number; status: string }[]
estimate_expense_items?: { id: number; status: string }[]
authorisation_method?: string
employee_id?: number
}) {
return this.post(ESTIMATE_ROUTES.STORE_AUTHORISATION, payload as never, { params: { id: estimateId } } as never)
}
}
+1
View File
@@ -38,6 +38,7 @@ export { InvoicesClient, INVOICE_ROUTES } from "./invoices"
export { HomeClient, HOME_ROUTES, type HomeDashboardResponse } from "./home"
export { BillsClient, BILL_ROUTES } from "./bills"
export { ReasonsClient, REASON_ROUTES } from "./reasons"
export { DocumentPrintClient, DOCUMENT_PRINT_ROUTES, type DocumentPrintType, type DocumentPrintMode } from "./document-print"
export { HolidaysClient, HOLIDAY_ROUTES } from "./holidays"
export { MakeAndModelsClient, MAKE_AND_MODEL_ROUTES } from "./make-and-models"
export { TimeSheetsClient, TIME_SHEET_ROUTES } from "./time-sheets"
+1 -1
View File
@@ -109,7 +109,7 @@ export const SellRatesTaxInclusive = ['Tax Inclusive', 'Tax Exclusive'] as const
export type SellRatesTaxInclusive = (typeof SellRatesTaxInclusive)[number];
// Tables
export const Tables= ['bills', 'expenses', 'invoices', 'job_cards', 'credit_notes', 'vendor_credits'] as const;
export const Tables= ['bills', 'expenses', 'invoices', 'job_cards', 'credit_notes', 'vendor_credits', 'estimates'] as const;
export type Tables = (typeof Tables)[number];
export const GiveDiscounts = ['no', 'line_item_level', 'transaction_level'] as const;
+49 -13
View File
@@ -12947,19 +12947,55 @@ export interface paths {
content: {
/**
* @example {
* "services_status": "accepted",
* "parts_status": "accepted",
* "inspections_status": "accepted",
* "expense_items_status": "accepted",
* "estimate_services": [
* {
* "id": 11,
* "status": "accepted"
* },
* {
* "id": 12,
* "status": "rejected"
* }
* ],
* "estimate_parts": [
* {
* "id": 21,
* "status": "accepted"
* }
* ],
* "estimate_inspections": [
* {
* "id": 31,
* "status": "pending"
* }
* ],
* "estimate_expense_items": [
* {
* "id": 41,
* "status": "accepted"
* }
* ],
* "authorisation_method": "in_person",
* "employee_id": 1
* }
*/
"application/json": {
services_status?: string;
parts_status?: string;
inspections_status?: string;
expense_items_status?: string;
estimate_services?: {
id?: number;
status?: string;
}[];
estimate_parts?: {
id?: number;
status?: string;
}[];
estimate_inspections?: {
id?: number;
status?: string;
}[];
estimate_expense_items?: {
id?: number;
status?: string;
}[];
authorisation_method?: string;
employee_id?: number;
};
@@ -12982,15 +13018,15 @@ export interface paths {
* "authorisation_date": "2026-04-13",
* "authorisation_time": "14:30:00",
* "authorisation_method": "in_person",
* "total_accepted": 8
* "total_accepted": 5
* },
* "updated_counts": {
* "services": 3,
* "parts": 2,
* "services": 2,
* "parts": 1,
* "inspections": 1,
* "expense_items": 2
* "expense_items": 1
* },
* "histories_count": 9
* "histories_count": 6
* }
* }
*/