initial commit

This commit is contained in:
2024-10-13 14:50:19 +00:00
commit dbdbf16bfe
34 changed files with 3035 additions and 0 deletions

21
models/Alias.ts Normal file
View 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
View 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
View 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
View 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
View 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
View 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
);