add assignedTo field to unique fields endpoint
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
updateTaskHandler,
|
||||
} from "./task.controller";
|
||||
import { noteRoutes } from "../note/note.route";
|
||||
import { getUniqueValuesTasks } from "./task.service";
|
||||
|
||||
export async function taskRoutes(fastify: FastifyInstance) {
|
||||
fastify.post(
|
||||
@@ -107,6 +108,35 @@ export async function taskRoutes(fastify: FastifyInstance) {
|
||||
newFilesHandler
|
||||
);
|
||||
|
||||
fastify.get(
|
||||
"/fields/:field",
|
||||
{
|
||||
schema: {
|
||||
params: {
|
||||
type: "object",
|
||||
properties: {
|
||||
field: { type: "string" },
|
||||
},
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: ["rts:read"] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
async (req, res) => {
|
||||
const { field } = req.params as { field: string };
|
||||
|
||||
try {
|
||||
const uniqueValues = await getUniqueValuesTasks(
|
||||
field,
|
||||
req.user.tenantId
|
||||
);
|
||||
return res.code(200).send(uniqueValues);
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
await noteRoutes(fastify, {
|
||||
read: "task:read",
|
||||
write: "task:write",
|
||||
|
||||
Reference in New Issue
Block a user