Skip to content

Commit 9704c69

Browse files
HyteqHyteq
authored andcommitted
fix: remove admin power
1 parent 6791375 commit 9704c69

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

apps/api/src/routes/v1/websites.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,6 @@ websitesRouter.get('/', async (c) => {
256256
return c.json({ success: false, error: "Unauthorized" }, 401);
257257
}
258258

259-
if (user.role === 'ADMIN') {
260-
const allWebsites = await db.query.websites.findMany({
261-
orderBy: (websites, { desc }) => [desc(websites.createdAt)]
262-
});
263-
return c.json({
264-
success: true,
265-
data: allWebsites
266-
});
267-
}
268-
269259
try {
270260
const userWebsites = await db.query.websites.findMany({
271261
where: eq(websites.userId, user.id),
@@ -365,6 +355,16 @@ websitesRouter.get('/:id', async (c) => {
365355
}
366356

367357
try {
358+
if (user.role === 'ADMIN') {
359+
const website = await db.query.websites.findFirst({
360+
where: eq(websites.id, id)
361+
});
362+
return c.json({
363+
success: true,
364+
data: website
365+
});
366+
}
367+
368368
const projectIds = await getUserProjectIds(user.id);
369369

370370
const website = await db.query.websites.findFirst({

0 commit comments

Comments
 (0)