mirror of
https://github.com/khairul169/code-share.git
synced 2026-10-24 11:53:58 +07:00
feat: update layout
This commit is contained in:
@@ -55,20 +55,20 @@ const projectRouter = router({
|
||||
isNull(project.deletedAt)
|
||||
);
|
||||
|
||||
const result = await db.query.project.findFirst({
|
||||
const projectData = await db.query.project.findFirst({
|
||||
where,
|
||||
with: {
|
||||
user: { columns: { password: false } },
|
||||
},
|
||||
});
|
||||
|
||||
if (!hasPermission(ctx, result, "r")) {
|
||||
throw new TRPCError({ code: "FORBIDDEN" });
|
||||
if (!projectData || !hasPermission(ctx, projectData, "r")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isMutable = hasPermission(ctx, result, "w");
|
||||
const isMutable = hasPermission(ctx, projectData, "w");
|
||||
|
||||
return { ...result, isMutable };
|
||||
return { ...projectData!, isMutable };
|
||||
}),
|
||||
|
||||
create: procedure
|
||||
|
||||
Reference in New Issue
Block a user