update invites endpoints to support latest api
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user