add unique value route to permits
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
createPermit,
|
||||
deletePermit,
|
||||
getPermit,
|
||||
getUniqueValues,
|
||||
listPermits,
|
||||
updatePermit,
|
||||
} from "./permit.service";
|
||||
@@ -90,3 +91,17 @@ export async function deletePermitHandler(
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUniqueFieldValues(
|
||||
req: FastifyRequest,
|
||||
res: FastifyReply
|
||||
) {
|
||||
const { field } = req.params as { field: string };
|
||||
|
||||
try {
|
||||
const uniqueValues = await getUniqueValues(field, req.user.tenantId);
|
||||
return res.code(200).send(uniqueValues);
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user