Compare commits
No commits in common. "ed90a4c3f9bbab801c72bc632dcb4813aa3120b2" and "ad9a518b97eb6debbbe80d34bd7703419457024c" have entirely different histories.
ed90a4c3f9
...
ad9a518b97
|
@ -52,5 +52,3 @@ export default class Member {
|
|||
@prop()
|
||||
public additionalAcknowledgement: MemberAdditionalAcknowledgement[] | undefined;
|
||||
}
|
||||
|
||||
export const MemberModel = getModelForClass(Member);
|
||||
|
|
|
@ -40,10 +40,7 @@ export enum PartnerCommissionType {
|
|||
TRIAL,
|
||||
}
|
||||
|
||||
export default class Partner {
|
||||
@prop({ required: true, unique: true })
|
||||
public discordID: string | undefined;
|
||||
|
||||
export default class Partner extends Member {
|
||||
@prop({ required: true })
|
||||
public roleType: PartnerRoleType | undefined;
|
||||
|
||||
|
@ -59,5 +56,3 @@ export default class Partner {
|
|||
@prop()
|
||||
public directReport: Partner | string | undefined;
|
||||
}
|
||||
|
||||
export const PartnerModel = getModelForClass(Partner);
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
import Partner, {
|
||||
PartnerCommissionType,
|
||||
PartnerDepartment,
|
||||
PartnerModel,
|
||||
PartnerRoleType,
|
||||
PartnerTitle
|
||||
} from "../database/Partner";
|
||||
import Member, { MemberAdditionalAcknowledgement, MemberModel } from "../database/Member";
|
||||
import { Client } from "discord.js";
|
||||
import { guildID } from "../config.json";
|
||||
|
||||
export interface PartnerOptions {
|
||||
roleType: PartnerRoleType;
|
||||
commissionType: PartnerCommissionType;
|
||||
department: PartnerDepartment;
|
||||
title: PartnerTitle;
|
||||
directReport: Partner | string;
|
||||
}
|
||||
|
||||
// TODO: Add the rest of the remaining role configurations
|
||||
export const PartnerDiscordRoleMap = {
|
||||
// Director of Engineering, Management, Staff, Technician, Core Team, Play Caller
|
||||
"Director of Engineering": ["1077646568091570236", "1077646956890951690", "446104438969466890", "701454780828221450", "453689940140883988", "1014978134573064293"],
|
||||
// Director of Operations, Management, Staff, Moderator, Core Team, Play Caller
|
||||
"Director of Operations": ["1077647072163020840", "1077646956890951690", "446104438969466890", "455972169449734144", "453689940140883988", "1014978134573064293"]
|
||||
}
|
||||
|
||||
export default class MemberUtil {
|
||||
public static async createNewPartner(member: Member, options: PartnerOptions) {
|
||||
const partner = new PartnerModel();
|
||||
partner.discordID = member.discordID;
|
||||
partner.roleType = options.roleType;
|
||||
partner.commissionType = options.commissionType;
|
||||
partner.department = options.department;
|
||||
partner.title = options.title;
|
||||
partner.directReport = options.directReport;
|
||||
await partner.save();
|
||||
return partner;
|
||||
}
|
||||
|
||||
public static async getPartner(member: Member) {
|
||||
return PartnerModel.findOne({ discordID: member.discordID });
|
||||
}
|
||||
|
||||
public static async deletePartner(member: Member) {
|
||||
return PartnerModel.deleteOne({ discordID: member.discordID });
|
||||
}
|
||||
|
||||
public static addAcknowledgementToMember(member: Member, acknowledgement: MemberAdditionalAcknowledgement) {
|
||||
if (!member.additionalAcknowledgement || member.additionalAcknowledgement?.length === 0) {
|
||||
MemberModel.updateOne({ discordID: member.discordID }, { additionalAcknowledgement: [] });
|
||||
}
|
||||
if (member.additionalAcknowledgement?.includes(acknowledgement)) throw new Error("This member already has this acknowledgement.")
|
||||
return MemberModel.updateOne({ discordID: member.discordID }, { $push: { additionalAcknowledgement: acknowledgement } });
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue