move validationResult to value instead, add create, delete, list, info route for guilds
All checks were successful
Code quality checks / biome (push) Successful in 11s
All checks were successful
Code quality checks / biome (push) Successful in 11s
This commit is contained in:
parent
ca0410f7fb
commit
1e6003079b
30 changed files with 870 additions and 90 deletions
|
@ -6,8 +6,7 @@ type genericValidation = {
|
|||
type validationResult = {
|
||||
valid: boolean;
|
||||
error?: string;
|
||||
username?: string;
|
||||
name?: string;
|
||||
value?: string;
|
||||
};
|
||||
|
||||
interface UrlValidationOptions {
|
||||
|
|
39
types/server/requests/guild/base.ts
Normal file
39
types/server/requests/guild/base.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
interface GuildResponse {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
iconUrl: string | null;
|
||||
bannerUrl: string | null;
|
||||
splashUrl: string | null;
|
||||
ownerId: string;
|
||||
verificationLevel: number;
|
||||
defaultMessageNotifications: number;
|
||||
systemChannelId: string | null;
|
||||
rulesChannelId: string | null;
|
||||
publicUpdatesChannelId: string | null;
|
||||
features: string[];
|
||||
preferredLocale: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
interface GuildRow {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
icon_url: string | null;
|
||||
banner_url: string | null;
|
||||
splash_url: string | null;
|
||||
owner_id: string;
|
||||
verification_level: number;
|
||||
default_message_notifications: number;
|
||||
system_channel_id: string | null;
|
||||
rules_channel_id: string | null;
|
||||
public_updates_channel_id: string | null;
|
||||
features: Set<string>;
|
||||
preferred_locale: string;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
}
|
||||
|
||||
export type { GuildResponse, GuildRow };
|
15
types/server/requests/guild/create.ts
Normal file
15
types/server/requests/guild/create.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import type { BaseResponse } from "../base";
|
||||
import type { GuildResponse } from "./base";
|
||||
|
||||
interface CreateGuildRequest {
|
||||
name: string;
|
||||
description?: string;
|
||||
icon_url?: string;
|
||||
banner_url?: string;
|
||||
}
|
||||
|
||||
interface CreateGuildResponse extends BaseResponse {
|
||||
guild?: GuildResponse;
|
||||
}
|
||||
|
||||
export type { CreateGuildRequest, CreateGuildResponse };
|
6
types/server/requests/guild/delete.ts
Normal file
6
types/server/requests/guild/delete.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
interface DeleteGuildRequest {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type { DeleteGuildRequest };
|
4
types/server/requests/guild/index.ts
Normal file
4
types/server/requests/guild/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
export * from "./base";
|
||||
export * from "./create";
|
||||
export * from "./delete";
|
||||
export * from "./list";
|
9
types/server/requests/guild/list.ts
Normal file
9
types/server/requests/guild/list.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import type { BaseResponse } from "../base";
|
||||
import type { GuildResponse } from "./base";
|
||||
|
||||
interface GuildListResponse extends BaseResponse {
|
||||
guilds?: GuildResponse[];
|
||||
count?: number;
|
||||
}
|
||||
|
||||
export type { GuildListResponse };
|
|
@ -1,3 +1,4 @@
|
|||
export * from "./user";
|
||||
export * from "./health";
|
||||
export * from "./base";
|
||||
export * from "./guild";
|
||||
|
|
|
@ -13,6 +13,7 @@ type RouteDef = {
|
|||
| "raw"
|
||||
| "buffer"
|
||||
| "blob";
|
||||
needsAuth?: boolean;
|
||||
};
|
||||
|
||||
type RouteModule = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue