fixed ts errors
This commit is contained in:
@@ -12,6 +12,9 @@ export default async function emailAsUserRoutes(server: FastifyInstance) {
|
||||
return reply.code(400).send({ error: "No tenant selected" });
|
||||
}
|
||||
|
||||
const { id } = req.params as { id: string };
|
||||
|
||||
|
||||
const body = req.body as {
|
||||
email: string
|
||||
password: string
|
||||
@@ -23,7 +26,7 @@ export default async function emailAsUserRoutes(server: FastifyInstance) {
|
||||
imap_ssl: boolean
|
||||
};
|
||||
|
||||
if(req.params.id) {
|
||||
if(id) {
|
||||
//SAVE Existing
|
||||
let saveData = {
|
||||
email_encrypted: body.email ? encrypt(body.email) : undefined,
|
||||
@@ -40,7 +43,7 @@ export default async function emailAsUserRoutes(server: FastifyInstance) {
|
||||
const { data, error } = await server.supabase
|
||||
.from("user_credentials")
|
||||
.update(saveData)
|
||||
.eq("id", req.params.id)
|
||||
.eq("id", id)
|
||||
.select("*")
|
||||
.single();
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@ export default async function functionRoutes(server: FastifyInstance) {
|
||||
|
||||
server.get("/functions/workingtimeevaluation/:profile_id", async (req, reply) => {
|
||||
|
||||
const { profile_id } = req.params as { profile_id: string };
|
||||
const { start_date, end_date } = req.query as { start_date: string, end_date: string };
|
||||
|
||||
|
||||
async function generateWorkingTimesEvaluationValues(profile_id,startDateInput,endDateInput) {
|
||||
|
||||
console.log(dayjs(startDateInput))
|
||||
@@ -219,8 +223,10 @@ export default async function functionRoutes(server: FastifyInstance) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
reply.send(await generateWorkingTimesEvaluationValues(req.params.profile_id,req.query.start_date,req.query.end_date))
|
||||
reply.send(await generateWorkingTimesEvaluationValues(profile_id,start_date,end_date))
|
||||
} catch(error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user