mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-25 06:16:40 +00:00
Fix bugs and change makefile
This commit is contained in:
@@ -37,7 +37,6 @@ export async function listRoleSites(req: Request, res: Response, next: NextFunct
|
||||
.select({
|
||||
siteId: sites.siteId,
|
||||
name: sites.name,
|
||||
subdomain: sites.subdomain,
|
||||
})
|
||||
.from(roleSites)
|
||||
.innerJoin(sites, eq(roleSites.siteId, sites.siteId))
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ActionsEnum, checkUserActionPermission } from '@server/auth/actions';
|
||||
import logger from '@server/logger';
|
||||
|
||||
const listRolesParamsSchema = z.object({
|
||||
orgId: z.string().optional().transform(Number).pipe(z.number().int().positive()),
|
||||
orgId: z.string()
|
||||
});
|
||||
|
||||
const listRolesSchema = z.object({
|
||||
@@ -61,14 +61,11 @@ export async function listRoles(req: Request, res: Response, next: NextFunction)
|
||||
orgName: orgs.name,
|
||||
})
|
||||
.from(roles)
|
||||
.leftJoin(orgs, eq(roles.orgId, orgs.orgId));
|
||||
.leftJoin(orgs, eq(roles.orgId, orgs.orgId))
|
||||
.where(eq(roles.orgId, orgId));
|
||||
|
||||
let countQuery: any = db.select({ count: sql<number>`cast(count(*) as integer)` }).from(roles);
|
||||
|
||||
if (orgId) {
|
||||
baseQuery = baseQuery.where(eq(roles.orgId, orgId));
|
||||
countQuery = countQuery.where(eq(roles.orgId, orgId));
|
||||
}
|
||||
let countQuery: any = db.select({ count: sql<number>`cast(count(*) as integer)` }).from(roles)
|
||||
.where(eq(roles.orgId, orgId));
|
||||
|
||||
const rolesList = await baseQuery.limit(limit).offset(offset);
|
||||
const totalCountResult = await countQuery;
|
||||
|
||||
@@ -25,7 +25,7 @@ const createSiteSchema = z.object({
|
||||
subnet: z.string().optional(),
|
||||
});
|
||||
|
||||
export type GetSiteResponse = {
|
||||
export type CreateSiteResponse = {
|
||||
name: string;
|
||||
siteId: number;
|
||||
orgId: string;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { eq } from 'drizzle-orm';
|
||||
|
||||
const addUserSiteSchema = z.object({
|
||||
userId: z.string(),
|
||||
siteId: z.string().optional().transform(stoi).pipe(z.number().int().positive().optional()),
|
||||
siteId: z.string().transform(Number).pipe(z.number().int().positive()),
|
||||
});
|
||||
|
||||
export async function addUserSite(req: Request, res: Response, next: NextFunction): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user