update role claims, refactor getUniqueValues
This commit is contained in:
@@ -5,12 +5,8 @@ import {
|
||||
deleteNoteHandler,
|
||||
updateNoteHandler,
|
||||
} from "./note.controller";
|
||||
import { Claim } from "../utils/claims";
|
||||
|
||||
export async function noteRoutes(
|
||||
fastify: FastifyInstance,
|
||||
claims: { read: Claim; write: Claim; delete: Claim }
|
||||
) {
|
||||
export async function noteRoutes(fastify: FastifyInstance) {
|
||||
fastify.post(
|
||||
"/:resourceId/notes",
|
||||
{
|
||||
@@ -20,7 +16,7 @@ export async function noteRoutes(
|
||||
properties: { resourceId: { type: "string" } },
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: [claims.write] },
|
||||
config: { requiredClaims: ["note:write"] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
createNoteHandler
|
||||
@@ -35,7 +31,7 @@ export async function noteRoutes(
|
||||
properties: { resourceId: { type: "string" } },
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: [claims.read] },
|
||||
config: { requiredClaims: ["note:read"] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
listNotesHandler
|
||||
@@ -53,7 +49,7 @@ export async function noteRoutes(
|
||||
},
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: [claims.write] },
|
||||
config: { requiredClaims: ["note:write"] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
updateNoteHandler
|
||||
@@ -71,7 +67,7 @@ export async function noteRoutes(
|
||||
},
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: [claims.write] },
|
||||
config: { requiredClaims: ["note:delete"] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
deleteNoteHandler
|
||||
|
||||
Reference in New Issue
Block a user