MCPcopy Create free account
hub / github.com/bsoc-bitbyte/busify / createBus

Method createBus

backend/src/Bus/bus.service.ts:15–34  ·  view source on GitHub ↗
(bus: any)

Source from the content-addressed store, hash-verified

13 }
14
15 async createBus(bus: any) {
16 try {
17 const busData = await this.prismaService.bus.findFirst({
18 where: {
19 number: bus.number,
20 },
21 });
22 if (busData) {
23 throw new HttpException('Bus already exists', 400);
24 } else {
25 return this.prismaService.bus.create({
26 data: {
27 ...bus,
28 },
29 });
30 }
31 } catch (error) {
32 throw new HttpException(error.message, error.status);
33 }
34 }
35 async getConductors() {
36 return this.prismaService.conductor.findMany({});
37 }

Callers 2

createScheduleMethod · 0.95
createNewBusMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected