Add merchant model
parent
0c30bde292
commit
b9ebe73eaa
|
@ -3,7 +3,7 @@ import pluris from 'pluris';
|
|||
import mongoose from 'mongoose';
|
||||
import { promises as fs } from 'fs';
|
||||
import { Collection, Command, LocalStorage, Util, ServerManagement, Event } from '.';
|
||||
import { File, FileInterface, Member, MemberInterface, Moderation, ModerationInterface, NNTrainingData, NNTrainingDataInterface, Note, NoteInterface, PagerNumber, PagerNumberInterface, Rank, RankInterface, Redirect, RedirectInterface, Score, ScoreInterface, Staff, StaffInterface, Stat, StatInterface } from '../models';
|
||||
import { File, FileInterface, Member, MemberInterface, Merchant, MerchantInterface, Moderation, ModerationInterface, NNTrainingData, NNTrainingDataInterface, Note, NoteInterface, PagerNumber, PagerNumberInterface, Rank, RankInterface, Redirect, RedirectInterface, Score, ScoreInterface, Staff, StaffInterface, Stat, StatInterface } from '../models';
|
||||
import { Config } from '../../types'; // eslint-disable-line
|
||||
|
||||
pluris(eris);
|
||||
|
@ -21,14 +21,14 @@ export default class Client extends eris.Client {
|
|||
|
||||
public serverManagement: ServerManagement;
|
||||
|
||||
public db: { File: mongoose.Model<FileInterface>, Member: mongoose.Model<MemberInterface>, Moderation: mongoose.Model<ModerationInterface>, NNTrainingData: mongoose.Model<NNTrainingDataInterface>, Note: mongoose.Model<NoteInterface>, PagerNumber: mongoose.Model<PagerNumberInterface>, Rank: mongoose.Model<RankInterface>, Redirect: mongoose.Model<RedirectInterface>, Score: mongoose.Model<ScoreInterface>, Staff: mongoose.Model<StaffInterface>, Stat: mongoose.Model<StatInterface>, local: { muted: LocalStorage } };
|
||||
public db: { File: mongoose.Model<FileInterface>, Member: mongoose.Model<MemberInterface>, Merchant: mongoose.Model<MerchantInterface>, Moderation: mongoose.Model<ModerationInterface>, NNTrainingData: mongoose.Model<NNTrainingDataInterface>, Note: mongoose.Model<NoteInterface>, PagerNumber: mongoose.Model<PagerNumberInterface>, Rank: mongoose.Model<RankInterface>, Redirect: mongoose.Model<RedirectInterface>, Score: mongoose.Model<ScoreInterface>, Staff: mongoose.Model<StaffInterface>, Stat: mongoose.Model<StatInterface>, local: { muted: LocalStorage } };
|
||||
|
||||
constructor(token: string, options?: eris.ClientOptions) {
|
||||
super(token, options);
|
||||
this.commands = new Collection<Command>();
|
||||
this.events = new Collection<Event>();
|
||||
this.intervals = new Collection<NodeJS.Timeout>();
|
||||
this.db = { File, Member, Moderation, NNTrainingData, Note, PagerNumber, Rank, Redirect, Score, Staff, Stat, local: { muted: new LocalStorage('muted') } };
|
||||
this.db = { File, Member, Merchant, Moderation, NNTrainingData, Note, PagerNumber, Rank, Redirect, Score, Staff, Stat, local: { muted: new LocalStorage('muted') } };
|
||||
}
|
||||
|
||||
public async loadDatabase() {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
import { Document, Schema, model } from 'mongoose';
|
||||
|
||||
export interface MerchantInterface extends Document {
|
||||
name: string,
|
||||
key: string,
|
||||
/**
|
||||
* type
|
||||
* - 0: hard
|
||||
* - 1: soft
|
||||
*/
|
||||
pulls: [{ type: 0 | 1, reason: string, date: Date }],
|
||||
}
|
||||
|
||||
const Merchant: Schema = new Schema({
|
||||
name: String,
|
||||
key: String,
|
||||
pulls: Array,
|
||||
});
|
||||
|
||||
export default model<MerchantInterface>('Merchant', Merchant);
|
|
@ -1,5 +1,6 @@
|
|||
export { default as File, FileInterface } from './File';
|
||||
export { default as Member, MemberInterface } from './Member';
|
||||
export { default as Merchant, MerchantInterface } from './Merchant';
|
||||
export { default as Moderation, ModerationInterface } from './Moderation';
|
||||
export { default as NNTrainingData, NNTrainingDataInterface } from './NNTrainingData';
|
||||
export { default as Note, NoteInterface } from './Note';
|
||||
|
|
Loading…
Reference in New Issue