refactor: update roles

This commit is contained in:
Mauricio Siu
2025-02-15 19:23:08 -06:00
parent d233f2c764
commit 1c5cc5a0db
45 changed files with 141 additions and 132 deletions

View File

@@ -38,7 +38,7 @@ export const mysqlRouter = createTRPCRouter({
.input(apiCreateMySql)
.mutation(async ({ input, ctx }) => {
try {
if (ctx.user.rol === "user") {
if (ctx.user.rol === "member") {
await checkServiceAccess(ctx.user.id, input.projectId, "create");
}
@@ -58,7 +58,7 @@ export const mysqlRouter = createTRPCRouter({
}
const newMysql = await createMysql(input);
if (ctx.user.rol === "user") {
if (ctx.user.rol === "member") {
await addNewService(ctx.user.id, newMysql.mysqlId);
}
@@ -85,7 +85,7 @@ export const mysqlRouter = createTRPCRouter({
one: protectedProcedure
.input(apiFindOneMySql)
.query(async ({ input, ctx }) => {
if (ctx.user.rol === "user") {
if (ctx.user.rol === "member") {
await checkServiceAccess(ctx.user.id, input.mysqlId, "access");
}
const mysql = await findMySqlById(input.mysqlId);
@@ -240,7 +240,7 @@ export const mysqlRouter = createTRPCRouter({
remove: protectedProcedure
.input(apiFindOneMySql)
.mutation(async ({ input, ctx }) => {
if (ctx.user.rol === "user") {
if (ctx.user.rol === "member") {
await checkServiceAccess(ctx.user.id, input.mysqlId, "delete");
}
const mongo = await findMySqlById(input.mysqlId);