initial commit
This commit is contained in:
21
models/Alias.ts
Normal file
21
models/Alias.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import {Schema, Types, model} from 'mongoose';
|
||||
|
||||
import {Image} from './Image';
|
||||
import {Guild} from './Guild';
|
||||
|
||||
export interface Alias{
|
||||
_id: Types.ObjectId;
|
||||
guild: Guild;
|
||||
text: string;
|
||||
images: Image[];
|
||||
}
|
||||
|
||||
const aliasSchema = new Schema<Alias>({
|
||||
guild: {type: Schema.Types.ObjectId, ref: 'Guild', required: true},
|
||||
text: {type: String, required: true},
|
||||
images: {type: [{type: Schema.Types.ObjectId, ref: 'Image'}], default: []},
|
||||
});
|
||||
|
||||
export const aliasModel = model<Alias>(
|
||||
'aliasModel', aliasSchema
|
||||
);
|
||||
22
models/AutoroleMsg.ts
Normal file
22
models/AutoroleMsg.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {Schema, Types, model} from 'mongoose';
|
||||
|
||||
import {Guild} from './Guild';
|
||||
|
||||
export interface AutoroleMsg{
|
||||
_id: Types.ObjectId;
|
||||
guild: Guild;
|
||||
messageId: string;
|
||||
emoji: string;
|
||||
roleId: string;
|
||||
}
|
||||
|
||||
const autoroleMsgSchema = new Schema<AutoroleMsg>({
|
||||
guild: {type: Schema.Types.ObjectId, required: true},
|
||||
messageId: {type: String, required: true},
|
||||
emoji: {type: String, required: false},
|
||||
roleId: {type: String, required: true},
|
||||
});
|
||||
|
||||
export const autoroleMsgModel = model<AutoroleMsg>(
|
||||
'autoroleMsgModel', autoroleMsgSchema
|
||||
);
|
||||
22
models/GiveawayMsg.ts
Normal file
22
models/GiveawayMsg.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {Schema, Types, model} from 'mongoose';
|
||||
|
||||
import {Guild} from './Guild';
|
||||
|
||||
export interface GiveawayMsg{
|
||||
_id: Types.ObjectId;
|
||||
guild: Guild;
|
||||
messageId: string;
|
||||
authorId: string;
|
||||
userIds: string[];
|
||||
}
|
||||
|
||||
const giveawayMsgSchema = new Schema<GiveawayMsg>({
|
||||
guild: {type: Schema.Types.ObjectId, required: true},
|
||||
messageId: {type: String, required: true},
|
||||
authorId: {type: String, required: true},
|
||||
userIds: {type: [{type: String}], default: []}
|
||||
});
|
||||
|
||||
export const giveawayMsgModel = model<GiveawayMsg>(
|
||||
'giveawayMsgModel', giveawayMsgSchema
|
||||
);
|
||||
23
models/Guild.ts
Normal file
23
models/Guild.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import {Schema, Types, model} from 'mongoose';
|
||||
|
||||
import {GiveawayMsg} from './GiveawayMsg';
|
||||
import {AutoroleMsg} from './AutoroleMsg';
|
||||
|
||||
export interface Guild{
|
||||
_id: Types.ObjectId;
|
||||
id: string;
|
||||
name: string;
|
||||
giveawayLogChannelId: string;
|
||||
autoroleLogChannelId: string;
|
||||
}
|
||||
|
||||
const guildSchema = new Schema<Guild>({
|
||||
id: {type: String, required: true},
|
||||
name: {type: String, required: true},
|
||||
giveawayLogChannelId: {type: String, required: false},
|
||||
autoroleLogChannelId: {type: String, required: false},
|
||||
});
|
||||
|
||||
export const guildModel = model<Guild>(
|
||||
'guildModel', guildSchema
|
||||
);
|
||||
14
models/Image.ts
Normal file
14
models/Image.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import {Schema, Types, model} from 'mongoose';
|
||||
|
||||
export interface Image{
|
||||
_id: Types.ObjectId; // act as random generated filename
|
||||
extension: string;
|
||||
}
|
||||
|
||||
const imageSchema = new Schema<Image>({
|
||||
extension: {type: String, required: true}
|
||||
});
|
||||
|
||||
export const imageModel = model<Image>(
|
||||
'imageModel', imageSchema
|
||||
);
|
||||
18
models/Token.ts
Normal file
18
models/Token.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import {Schema, Types, model} from 'mongoose';
|
||||
|
||||
export interface Token{
|
||||
_id: Types.ObjectId;
|
||||
token: string;
|
||||
guildId: string;
|
||||
exp: number;
|
||||
};
|
||||
|
||||
const tokenSchema = new Schema<Token>({
|
||||
token: {type: String, required: true},
|
||||
guildId: {type: String, required: true},
|
||||
exp: {type: Number, required: true}
|
||||
});
|
||||
|
||||
export const tokenModel = model<Token>(
|
||||
'tokenModel', tokenSchema
|
||||
);
|
||||
Reference in New Issue
Block a user