3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 23:25:02 +00:00

Use actions/events for plugin interoperability. Move base case and mute functionality to their own plugins.

This commit is contained in:
Dragory 2018-11-25 17:04:26 +02:00
parent 993b38db74
commit 1020747398
14 changed files with 674 additions and 332 deletions

View file

@ -53,26 +53,24 @@ export class GuildCases extends BaseRepository {
});
}
async create(data): Promise<number> {
async create(data): Promise<Case> {
const result = await this.cases.insert({
...data,
guild_id: this.guildId,
case_number: () => `(SELECT IFNULL(MAX(case_number)+1, 1) FROM cases AS ma2 WHERE guild_id = ${this.guildId})`
});
return result.identifiers[0].id;
return this.find(result.identifiers[0].id);
}
update(id, data) {
return this.cases.update(id, data);
}
async createNote(caseId: number, data: any): Promise<number> {
const result = await this.caseNotes.insert({
async createNote(caseId: number, data: any): Promise<void> {
await this.caseNotes.insert({
...data,
case_id: caseId
});
return result.identifiers[0].id;
}
}