This commit is contained in:
2026-04-07 14:45:29 +03:00
parent c47f7c1b6a
commit 38ef10da4d
11 changed files with 1006 additions and 13 deletions
+249
View File
@@ -24549,6 +24549,255 @@
}
}
},
"/api/job-cards/{id}/check-in": {
"post": {
"tags": [
"Job Cards"
],
"summary": "POST /api/job-cards/{id}/check-in",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"check_in_date": {
"type": "string"
},
"check_in_time": {
"type": "string"
},
"km_in": {
"type": "integer"
},
"fuel_level": {
"type": "string"
},
"start_date": {
"type": "string"
},
"start_time": {
"type": "string"
},
"department_id": {
"type": "integer"
},
"delivery_date": {
"type": "string"
},
"delivery_time": {
"type": "string"
}
}
},
"example": {
"check_in_date": "2026-04-07",
"check_in_time": "09:30",
"km_in": 50321,
"fuel_level": "half",
"start_date": "2026-04-07",
"start_time": "10:00",
"department_id": 1,
"delivery_date": "2026-04-08",
"delivery_time": "17:15"
}
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"status": {
"type": "string"
},
"check_in_date": {
"type": "string",
"format": "date-time"
},
"check_in_time": {
"type": "string"
},
"km_in": {
"type": "integer"
},
"fuel_level": {
"type": "string"
},
"start_date": {
"type": "string",
"format": "date-time"
},
"start_time": {
"type": "string"
},
"department_id": {
"type": "integer"
},
"delivery_date": {
"type": "string",
"format": "date-time"
},
"delivery_time": {
"type": "string"
}
}
}
}
},
"example": {
"message": "Job card checked in successfully.",
"data": {
"id": 1,
"status": "check_in",
"check_in_date": "2026-04-07T00:00:00.000000Z",
"check_in_time": "09:30:00",
"km_in": 50321,
"fuel_level": "half",
"start_date": "2026-04-07T00:00:00.000000Z",
"start_time": "10:00:00",
"department_id": 1,
"delivery_date": "2026-04-08T00:00:00.000000Z",
"delivery_time": "17:15:00"
}
}
}
}
}
}
}
},
"/api/job-cards/{id}/delivery": {
"post": {
"tags": [
"Job Cards"
],
"summary": "POST /api/job-cards/{id}/delivery",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"check_out_date": {
"type": "string"
},
"check_out_time": {
"type": "string"
},
"km_out": {
"type": "integer"
},
"fuel_level": {
"type": "string"
},
"department_id": {
"type": "integer"
}
}
},
"example": {
"check_out_date": "2026-04-08",
"check_out_time": "17:15",
"km_out": 50480,
"fuel_level": "quarter",
"department_id": 1
}
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"status": {
"type": "string"
},
"check_out_date": {
"type": "string"
},
"check_out_time": {
"type": "string"
},
"km_out": {
"type": "integer"
},
"fuel_level": {
"type": "string"
},
"department_id": {
"type": "integer"
}
}
}
}
},
"example": {
"message": "Job card marked as delivered successfully.",
"data": {
"id": 1,
"status": "delivered",
"check_out_date": "2026-04-08",
"check_out_time": "17:15:00",
"km_out": 50480,
"fuel_level": "quarter",
"department_id": 1
}
}
}
}
}
}
}
},
"/api/job-cards/{id}/add-customer-remark": {
"post": {
"tags": [
+218 -2
View File
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "4fac95bb-3550-48ab-9943-212b6e3a11d8",
"_postman_id": "bf46649e-48e0-49d5-aa87-1790dcbc3c24",
"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",
@@ -8025,7 +8025,7 @@
"{{table}}"
]
},
"description": "Set {{table}} to job_cards or estimates. Returns next sequence like ORD-0001 or EST-0001."
"description": "Set {{table}} to any supported table with a number column. Explicit prefixes: job_cards=ORD-, estimates=EST-, invoices=INV-, purchase_orders=PO-, bills=BILL-, expenses=EXP-, tasks=TASK-, appointments=APPT-, services=SRV-, parts=PART-, expense_items=EXP-ITEM-, inspections=INS-. Returns next sequence like ORD-0001."
},
"response": [
{
@@ -16771,6 +16771,222 @@
}
]
},
{
"name": "POST /api/job-cards/{id}/check-in",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"check_in_date\": \"2026-04-07\",\n \"check_in_time\": \"09:30\",\n \"km_in\": 50321,\n \"fuel_level\": \"half\",\n \"start_date\": \"2026-04-07\",\n \"start_time\": \"10:00\",\n \"department_id\": 1,\n \"delivery_date\": \"2026-04-08\",\n \"delivery_time\": \"17:15\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/job-cards/{{id}}/check-in",
"host": [
"{{base_url}}"
],
"path": [
"api",
"job-cards",
"{{id}}",
"check-in"
]
},
"description": "Marks job card as `check_in` and updates check-in context. Optional fields: `check_in_date`, `check_in_time` (HH:MM or HH:MM:SS), `km_in`, `fuel_level`, `start_date`, `start_time`, `department_id`, `delivery_date`, `delivery_time` (HH:MM or HH:MM:SS). If check-in date/time is omitted, server current date/time is used."
},
"response": [
{
"name": "200 OK",
"originalRequest": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"check_in_date\": \"2026-04-07\",\n \"check_in_time\": \"09:30\",\n \"km_in\": 50321,\n \"fuel_level\": \"half\",\n \"start_date\": \"2026-04-07\",\n \"start_time\": \"10:00\",\n \"department_id\": 1,\n \"delivery_date\": \"2026-04-08\",\n \"delivery_time\": \"17:15\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/job-cards/{{id}}/check-in",
"host": [
"{{base_url}}"
],
"path": [
"api",
"job-cards",
"{{id}}",
"check-in"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"message\": \"Job card checked in successfully.\",\n \"data\": {\n \"id\": 1,\n \"status\": \"check_in\",\n \"check_in_date\": \"2026-04-07T00:00:00.000000Z\",\n \"check_in_time\": \"09:30:00\",\n \"km_in\": 50321,\n \"fuel_level\": \"half\",\n \"start_date\": \"2026-04-07T00:00:00.000000Z\",\n \"start_time\": \"10:00:00\",\n \"department_id\": 1,\n \"delivery_date\": \"2026-04-08T00:00:00.000000Z\",\n \"delivery_time\": \"17:15:00\"\n }\n}"
}
]
},
{
"name": "POST /api/job-cards/{id}/delivery",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"check_out_date\": \"2026-04-08\",\n \"check_out_time\": \"17:15\",\n \"km_out\": 50480,\n \"fuel_level\": \"quarter\",\n \"department_id\": 1\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/job-cards/{{id}}/delivery",
"host": [
"{{base_url}}"
],
"path": [
"api",
"job-cards",
"{{id}}",
"delivery"
]
},
"description": "Marks job card as `delivered` and updates delivery context. Optional fields: `check_out_date`, `check_out_time` (HH:MM or HH:MM:SS), `km_out`, `fuel_level`, `department_id`. If check-out date/time is omitted, server current date/time is used."
},
"response": [
{
"name": "200 OK",
"originalRequest": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"check_out_date\": \"2026-04-08\",\n \"check_out_time\": \"17:15\",\n \"km_out\": 50480,\n \"fuel_level\": \"quarter\",\n \"department_id\": 1\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/job-cards/{{id}}/delivery",
"host": [
"{{base_url}}"
],
"path": [
"api",
"job-cards",
"{{id}}",
"delivery"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"message\": \"Job card marked as delivered successfully.\",\n \"data\": {\n \"id\": 1,\n \"status\": \"delivered\",\n \"check_out_date\": \"2026-04-08\",\n \"check_out_time\": \"17:15:00\",\n \"km_out\": 50480,\n \"fuel_level\": \"quarter\",\n \"department_id\": 1\n }\n}"
}
]
},
{
"name": "POST /api/job-cards/{id}/add-customer-remark",
"request": {
+11 -1
View File
@@ -1,13 +1,15 @@
import { CrudClient } from "../infra/crud-client"
import type { ApiClientOptions } from "../infra/client"
import type { ApiOperationResponse, ApiPath, ApiRequestBody, ApiResponse } from "../infra/types"
import { ApiBaseResponse } from "../contracts/types"
import { ApiBaseResponse } from "src/contracts/types"
export const JOB_CARD_ROUTES = {
INDEX: "/api/job-cards",
BY_ID: "/api/job-cards/{id}",
CHANGE_DATE: "/api/job-cards/{id}/change-date",
CHANGE_STATUS: "/api/job-cards/{id}/change-status",
CHECK_IN: "/api/job-cards/{id}/check-in",
DELIVERY: "/api/job-cards/{id}/delivery",
ADD_CUSTOMER_REMARK: "/api/job-cards/{id}/add-customer-remark",
EDIT_CUSTOMER_REMARK: "/api/job-cards/{id}/edit-customer-remark",
DELETE_CUSTOMER_REMARK: "/api/job-cards/{id}/delete-customer-remark",
@@ -53,6 +55,14 @@ export class JobCardsClient extends CrudClient<
return this.post(JOB_CARD_ROUTES.CHANGE_STATUS, payload, { params: { id } })
}
async checkIn(id: string, payload: ApiRequestBody<typeof JOB_CARD_ROUTES.CHECK_IN, "post">) {
return this.post(JOB_CARD_ROUTES.CHECK_IN, payload, { params: { id } })
}
async delivery(id: string, payload: ApiRequestBody<typeof JOB_CARD_ROUTES.DELIVERY, "post">) {
return this.post(JOB_CARD_ROUTES.DELIVERY, payload, { params: { id } })
}
async addCustomerRemark(id: string, payload: ApiRequestBody<typeof JOB_CARD_ROUTES.ADD_CUSTOMER_REMARK, "post">) {
return this.post(JOB_CARD_ROUTES.ADD_CUSTOMER_REMARK, payload, { params: { id } })
}
+183
View File
@@ -16105,6 +16105,189 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/job-cards/{id}/check-in": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** POST /api/job-cards/{id}/check-in */
post: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody: {
content: {
/**
* @example {
* "check_in_date": "2026-04-07",
* "check_in_time": "09:30",
* "km_in": 50321,
* "fuel_level": "half",
* "start_date": "2026-04-07",
* "start_time": "10:00",
* "department_id": 1,
* "delivery_date": "2026-04-08",
* "delivery_time": "17:15"
* }
*/
"application/json": {
check_in_date?: string;
check_in_time?: string;
km_in?: number;
fuel_level?: string;
start_date?: string;
start_time?: string;
department_id?: number;
delivery_date?: string;
delivery_time?: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
/**
* @example {
* "message": "Job card checked in successfully.",
* "data": {
* "id": 1,
* "status": "check_in",
* "check_in_date": "2026-04-07T00:00:00.000000Z",
* "check_in_time": "09:30:00",
* "km_in": 50321,
* "fuel_level": "half",
* "start_date": "2026-04-07T00:00:00.000000Z",
* "start_time": "10:00:00",
* "department_id": 1,
* "delivery_date": "2026-04-08T00:00:00.000000Z",
* "delivery_time": "17:15:00"
* }
* }
*/
"application/json": {
message?: string;
data?: {
id?: number;
status?: string;
/** Format: date-time */
check_in_date?: string;
check_in_time?: string;
km_in?: number;
fuel_level?: string;
/** Format: date-time */
start_date?: string;
start_time?: string;
department_id?: number;
/** Format: date-time */
delivery_date?: string;
delivery_time?: string;
};
};
};
};
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/job-cards/{id}/delivery": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/** POST /api/job-cards/{id}/delivery */
post: {
parameters: {
query?: never;
header?: never;
path: {
id: string;
};
cookie?: never;
};
requestBody: {
content: {
/**
* @example {
* "check_out_date": "2026-04-08",
* "check_out_time": "17:15",
* "km_out": 50480,
* "fuel_level": "quarter",
* "department_id": 1
* }
*/
"application/json": {
check_out_date?: string;
check_out_time?: string;
km_out?: number;
fuel_level?: string;
department_id?: number;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
/**
* @example {
* "message": "Job card marked as delivered successfully.",
* "data": {
* "id": 1,
* "status": "delivered",
* "check_out_date": "2026-04-08",
* "check_out_time": "17:15:00",
* "km_out": 50480,
* "fuel_level": "quarter",
* "department_id": 1
* }
* }
*/
"application/json": {
message?: string;
data?: {
id?: number;
status?: string;
check_out_date?: string;
check_out_time?: string;
km_out?: number;
fuel_level?: string;
department_id?: number;
};
};
};
};
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/job-cards/{id}/add-customer-remark": {
parameters: {
query?: never;