Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 4x 4x 4x 8x 1x 2x 2x 2x 1x 1x | import { Injectable } from '@nestjs/common';
import { Paginated, WorkOrderDto } from '../http/api-types';
import { DownstreamClient } from '../http/downstream.client';
@Injectable()
export class WorkOrdersClient extends DownstreamClient {
constructor() {
super(
process.env.WORK_ORDERS_URL ?? 'http://localhost:3001',
'work-orders service',
);
}
create(body: unknown): Promise<WorkOrderDto> {
return this.post('/work-orders', body);
}
list(query: Record<string, string>): Promise<Paginated<WorkOrderDto>> {
const search = new URLSearchParams(query).toString();
return this.get(`/work-orders${search ? `?${search}` : ''}`);
}
getById(id: string): Promise<WorkOrderDto> {
return this.get(`/work-orders/${id}`);
}
assign(id: string, body: unknown): Promise<WorkOrderDto> {
return this.patch(`/work-orders/${id}/assign`, body);
}
updateStatus(id: string, body: unknown): Promise<WorkOrderDto> {
return this.patch(`/work-orders/${id}/status`, body);
}
}
|