mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-04 18:14:53 +02:00
Merge branch 'main' of https://github.com/fosrl/pangolin
This commit is contained in:
commit
0386d81b95
95 changed files with 1640 additions and 1206 deletions
|
@ -9,9 +9,11 @@ import createHttpError from "http-errors";
|
|||
import logger from "@server/logger";
|
||||
import { fromError } from "zod-validation-error";
|
||||
|
||||
const getOrgSchema = z.object({
|
||||
orgId: z.string(),
|
||||
});
|
||||
const getOrgSchema = z
|
||||
.object({
|
||||
orgId: z.string()
|
||||
})
|
||||
.strict();
|
||||
|
||||
export async function checkId(
|
||||
req: Request,
|
||||
|
@ -43,7 +45,7 @@ export async function checkId(
|
|||
success: true,
|
||||
error: false,
|
||||
message: "Organization ID already exists",
|
||||
status: HttpCode.OK,
|
||||
status: HttpCode.OK
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -52,7 +54,7 @@ export async function checkId(
|
|||
success: true,
|
||||
error: false,
|
||||
message: "Organization ID is available",
|
||||
status: HttpCode.NOT_FOUND,
|
||||
status: HttpCode.NOT_FOUND
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
|
|
|
@ -18,9 +18,11 @@ import { fromError } from "zod-validation-error";
|
|||
import { sendToClient } from "../ws";
|
||||
import { deletePeer } from "../gerbil/peers";
|
||||
|
||||
const deleteOrgSchema = z.object({
|
||||
orgId: z.string()
|
||||
});
|
||||
const deleteOrgSchema = z
|
||||
.object({
|
||||
orgId: z.string()
|
||||
})
|
||||
.strict();
|
||||
|
||||
export async function deleteOrg(
|
||||
req: Request,
|
||||
|
|
|
@ -8,9 +8,11 @@ import HttpCode from "@server/types/HttpCode";
|
|||
import createHttpError from "http-errors";
|
||||
import logger from "@server/logger";
|
||||
|
||||
const getOrgSchema = z.object({
|
||||
orgId: z.string(),
|
||||
});
|
||||
const getOrgSchema = z
|
||||
.object({
|
||||
orgId: z.string()
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type GetOrgResponse = {
|
||||
org: Org;
|
||||
|
@ -51,12 +53,12 @@ export async function getOrg(
|
|||
|
||||
return response<GetOrgResponse>(res, {
|
||||
data: {
|
||||
org: org[0],
|
||||
org: org[0]
|
||||
},
|
||||
success: true,
|
||||
error: false,
|
||||
message: "Organization retrieved successfully",
|
||||
status: HttpCode.OK,
|
||||
status: HttpCode.OK
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
|
|
|
@ -9,9 +9,11 @@ import createHttpError from "http-errors";
|
|||
import logger from "@server/logger";
|
||||
import { fromError } from "zod-validation-error";
|
||||
|
||||
const updateOrgParamsSchema = z.object({
|
||||
orgId: z.string(),
|
||||
});
|
||||
const updateOrgParamsSchema = z
|
||||
.object({
|
||||
orgId: z.string()
|
||||
})
|
||||
.strict();
|
||||
|
||||
const updateOrgBodySchema = z
|
||||
.object({
|
||||
|
@ -20,7 +22,7 @@ const updateOrgBodySchema = z
|
|||
})
|
||||
.strict()
|
||||
.refine((data) => Object.keys(data).length > 0, {
|
||||
message: "At least one field must be provided for update",
|
||||
message: "At least one field must be provided for update"
|
||||
});
|
||||
|
||||
export async function updateOrg(
|
||||
|
@ -72,7 +74,7 @@ export async function updateOrg(
|
|||
success: true,
|
||||
error: false,
|
||||
message: "Organization updated successfully",
|
||||
status: HttpCode.OK,
|
||||
status: HttpCode.OK
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue