projeto-hit/backend/src/services/StatusChatEndService/ShowStatusChatEndService.ts

21 lines
483 B
TypeScript
Raw Normal View History

import StatusChatEnd from "../../models/StatusChatEnd";
import AppError from "../../errors/AppError";
2023-07-20 15:30:26 +00:00
const ShowStatusChatEndService = async (
id: string | number
): Promise<StatusChatEnd> => {
const status = await StatusChatEnd.findByPk(id, {
attributes: ["id", "name"]
});
console.log(`---------------> statusChatEnd id: ${id}`);
if (!status) {
throw new AppError("ERR_NO_STATUS_FOUND", 404);
}
return status;
};
2023-07-20 15:30:26 +00:00
export default ShowStatusChatEndService;