diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-08-12 00:43:00 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-08-12 00:43:00 +1000 |
commit | 23e234a87b0a269f38d0d2f33bfc814bf7346310 (patch) | |
tree | e31357a72d17405faadb994af6d7a65e96524cc3 /src/util | |
parent | goof (diff) | |
download | server-23e234a87b0a269f38d0d2f33bfc814bf7346310.tar.xz |
update invites endpoints to support latest api
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/entities/Invite.ts | 9 | ||||
-rw-r--r-- | src/util/schemas/InviteCreateSchema.ts | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/util/entities/Invite.ts b/src/util/entities/Invite.ts index 3019709f..7970c4f0 100644 --- a/src/util/entities/Invite.ts +++ b/src/util/entities/Invite.ts @@ -17,10 +17,10 @@ */ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; -import { Member } from "./Member"; import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass"; import { Channel } from "./Channel"; import { Guild } from "./Guild"; +import { Member } from "./Member"; import { User } from "./User"; export const PublicInviteRelation = ["inviter", "guild", "channel"]; @@ -45,8 +45,8 @@ export class Invite extends BaseClassWithoutId { @Column() created_at: Date; - @Column() - expires_at: Date; + @Column({ nullable: true }) + expires_at?: Date; @Column({ nullable: true }) @RelationId((invite: Invite) => invite.guild) @@ -94,6 +94,9 @@ export class Invite extends BaseClassWithoutId { @Column({ nullable: true }) vanity_url?: boolean; + @Column() + flags: number; + static async joinGuild(user_id: string, code: string) { const invite = await Invite.findOneOrFail({ where: { code } }); if (invite.uses++ >= invite.max_uses && invite.max_uses !== 0) diff --git a/src/util/schemas/InviteCreateSchema.ts b/src/util/schemas/InviteCreateSchema.ts index 6cdc0214..92333e77 100644 --- a/src/util/schemas/InviteCreateSchema.ts +++ b/src/util/schemas/InviteCreateSchema.ts @@ -26,4 +26,5 @@ export interface InviteCreateSchema { unique?: boolean; target_user?: string; target_user_type?: number; + flags?: number; } |