2023-05-19 15:22:48 -03:00
|
|
|
/* eslint-disable @typescript-eslint/no-misused-promises */
|
|
|
|
import { toDatabaseAccount, toCreateAccount } from "@/src/helpers/customHelpers";
|
|
|
|
import { createAccount } from "@/src/services/loginService";
|
|
|
|
import { RequestHandler } from "express";
|
|
|
|
|
|
|
|
const createAccountController: RequestHandler = async (req, res) => {
|
2023-05-23 20:42:06 -04:00
|
|
|
const createAccountData = toCreateAccount(req.body);
|
|
|
|
const databaseAccount = toDatabaseAccount(createAccountData);
|
2023-05-19 15:22:48 -03:00
|
|
|
|
2023-05-23 20:42:06 -04:00
|
|
|
const account = await createAccount(databaseAccount);
|
|
|
|
res.json(account);
|
2023-05-19 15:22:48 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
export { createAccountController };
|