Skip to content

Commit

Permalink
easy
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Nov 2, 2024
1 parent c82e4ea commit 26a5cfd
Showing 1 changed file with 34 additions and 25 deletions.
59 changes: 34 additions & 25 deletions src/elysia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,40 @@ import { verifyAllUsers } from "./lib/members/verifyAllUsers.js";
import { bot } from "./main.js";
import { prisma } from "./prisma.js";

const UserSchema = t.Object({
id: t.String(),
username: t.String(),
globalName: t.Nullable(t.String()),
joinedAt: t.String(),
displayAvatarURL: t.String(),
bannerUrl: t.Union([t.String(), t.Null(), t.Undefined()]),
displayHexColor: t.Optional(t.String()),
memberRoles: t.Array(t.String()),
});

const NewsAttachmentSchema = t.Object({
url: t.String(),
width: t.Union([t.Number(), t.Null()]),
height: t.Union([t.Number(), t.Null()]),
contentType: t.Union([t.String(), t.Null()]),
});

const NewsSchema = t.Object({
id: t.String(),
content: t.String(),
createdAt: t.String(),
attachments: t.Array(NewsAttachmentSchema),
user: UserSchema,
});
const UserSchema = t.Object(
{
id: t.String(),
username: t.String(),
globalName: t.Nullable(t.String()),
joinedAt: t.String(),
displayAvatarURL: t.String(),
bannerUrl: t.Union([t.String(), t.Null(), t.Undefined()]),
displayHexColor: t.Optional(t.String()),
memberRoles: t.Array(t.String()),
},
{ $id: "User" }
);

const NewsAttachmentSchema = t.Object(
{
url: t.String(),
width: t.Union([t.Number(), t.Null()]),
height: t.Union([t.Number(), t.Null()]),
contentType: t.Union([t.String(), t.Null()]),
},
{ $id: "NewsAttachment" }
);

const NewsSchema = t.Object(
{
id: t.String(),
content: t.String(),
createdAt: t.String(),
attachments: t.Array(NewsAttachmentSchema),
user: UserSchema,
},
{ $id: "News" }
);

const cache: Record<string, any> = {};
const locks: Record<string, boolean> = {};
Expand Down

0 comments on commit 26a5cfd

Please sign in to comment.