| 2 | import { prisma } from "../prisma"; |
| 3 | |
| 4 | export function timeTrackingRoutes(fastify: FastifyInstance) { |
| 5 | // Create a new entry |
| 6 | fastify.post( |
| 7 | "/api/v1/time/new", |
| 8 | |
| 9 | async (request: FastifyRequest, reply: FastifyReply) => { |
| 10 | const { time, ticket, title, user }: any = request.body; |
| 11 | |
| 12 | console.log(request.body); |
| 13 | |
| 14 | await prisma.timeTracking.create({ |
| 15 | data: { |
| 16 | time: Number(time), |
| 17 | title, |
| 18 | userId: user, |
| 19 | ticketId: ticket, |
| 20 | }, |
| 21 | }); |
| 22 | |
| 23 | reply.send({ |
| 24 | success: true, |
| 25 | }); |
| 26 | } |
| 27 | ); |
| 28 | |
| 29 | // Get all entries |
| 30 | |
| 31 | // Delete an entry |
| 32 | } |