24 lines
740 B
TypeScript
24 lines
740 B
TypeScript
import { Injectable } from "@nestjs/common";
|
|
import { PrismaMariaDbService } from "prisma/mariadb/prisma-mariadb.service";
|
|
import { Result } from "src/common/errors/result-error.factory";
|
|
|
|
@Injectable()
|
|
export class UpdateTicketService {
|
|
constructor(private readonly prisma: PrismaMariaDbService) { }
|
|
|
|
updateTicketById = async (
|
|
ticketId: number
|
|
): Promise<Result<boolean, string>> => {
|
|
try {
|
|
await this.prisma.ticket.update({
|
|
where: { id: ticketId },
|
|
data: {}
|
|
})
|
|
|
|
return { success: true, data: true }
|
|
} catch (error) {
|
|
console.error(error)
|
|
return { success: false, error: 'INVALID_TICKET_ID' }
|
|
}
|
|
}
|
|
} |