forked from engineering/crv2
correct Ref for directReport in PartnerModel
parent
dac548d82c
commit
58841b2830
|
@ -1,4 +1,4 @@
|
||||||
import { prop, getModelForClass } from "@typegoose/typegoose";
|
import { prop, getModelForClass, Ref } from "@typegoose/typegoose";
|
||||||
import Member from "./Member";
|
import Member from "./Member";
|
||||||
|
|
||||||
/* TODO
|
/* TODO
|
||||||
|
@ -60,9 +60,9 @@ export default class Partner implements SharedMemberAttributes {
|
||||||
@prop({ required: true })
|
@prop({ required: true })
|
||||||
public title: PartnerTitle | "Partner" | undefined;
|
public title: PartnerTitle | "Partner" | undefined;
|
||||||
|
|
||||||
@prop()
|
@prop({ ref: () => Partner })
|
||||||
//
|
//
|
||||||
public directReport: Partner | string | undefined;
|
public directReport?: Ref<Partner> | string | undefined;
|
||||||
|
|
||||||
@prop()
|
@prop()
|
||||||
// this field dictates if the partner is able to perform developer commands, such as "eval"
|
// this field dictates if the partner is able to perform developer commands, such as "eval"
|
||||||
|
|
|
@ -8,13 +8,14 @@ import Partner, {
|
||||||
import Member, { MemberAdditionalAcknowledgement, MemberModel } from "../database/Member";
|
import Member, { MemberAdditionalAcknowledgement, MemberModel } from "../database/Member";
|
||||||
import { Client, GuildMember, User } from "discord.js";
|
import { Client, GuildMember, User } from "discord.js";
|
||||||
import { guildID } from "../config.json";
|
import { guildID } from "../config.json";
|
||||||
|
import { Ref } from "@typegoose/typegoose";
|
||||||
|
|
||||||
export interface PartnerOptions {
|
export interface PartnerOptions {
|
||||||
roleType: PartnerRoleType;
|
roleType: PartnerRoleType;
|
||||||
commissionType: PartnerCommissionType;
|
commissionType: PartnerCommissionType;
|
||||||
department: PartnerDepartment;
|
department: PartnerDepartment;
|
||||||
title: PartnerTitle;
|
title: PartnerTitle;
|
||||||
directReport: Partner | string;
|
directReport: Ref<Partner>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FormatNameOptions {
|
export interface FormatNameOptions {
|
||||||
|
@ -25,7 +26,7 @@ export interface FormatNameOptions {
|
||||||
// TODO: Add the rest of the remaining role configurations
|
// TODO: Add the rest of the remaining role configurations
|
||||||
export const PartnerDiscordRoleMap = {
|
export const PartnerDiscordRoleMap = {
|
||||||
// Director of Engineering, Management, Staff, Technician, Core Team, Play Caller
|
// Director of Engineering, Management, Staff, Technician, Core Team, Play Caller
|
||||||
"Director of Engineering": [
|
Engineering: [
|
||||||
"1077646568091570236",
|
"1077646568091570236",
|
||||||
"1077646956890951690",
|
"1077646956890951690",
|
||||||
"446104438969466890",
|
"446104438969466890",
|
||||||
|
@ -34,7 +35,7 @@ export const PartnerDiscordRoleMap = {
|
||||||
"1014978134573064293",
|
"1014978134573064293",
|
||||||
],
|
],
|
||||||
// Director of Operations, Management, Staff, Moderator, Core Team, Play Caller
|
// Director of Operations, Management, Staff, Moderator, Core Team, Play Caller
|
||||||
"Director of Operations": [
|
Operations: [
|
||||||
"1077647072163020840",
|
"1077647072163020840",
|
||||||
"1077646956890951690",
|
"1077646956890951690",
|
||||||
"446104438969466890",
|
"446104438969466890",
|
||||||
|
@ -79,40 +80,4 @@ export default class MemberUtil {
|
||||||
{ $push: { additionalAcknowledgement: acknowledgement } }
|
{ $push: { additionalAcknowledgement: acknowledgement } }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: comments and extended formatting
|
|
||||||
public static formatName(
|
|
||||||
target: GuildMember | User,
|
|
||||||
partner?: Partner | null
|
|
||||||
): FormatNameOptions {
|
|
||||||
console.log(
|
|
||||||
`[MemberUtil] Formatting name for ${target.displayName} at url ${target instanceof GuildMember ? target.user.displayAvatarURL() : target.displayAvatarURL()}`
|
|
||||||
);
|
|
||||||
// if the role type is managerial, add a [k] to the end of the name
|
|
||||||
// if the partner exists, set the iconURL to the organizational logo
|
|
||||||
if (partner?.roleType == PartnerRoleType.MANAGERIAL) {
|
|
||||||
return {
|
|
||||||
text: `${target.displayName} [k]`,
|
|
||||||
iconURL: target.displayAvatarURL(),
|
|
||||||
};
|
|
||||||
} else if (partner?.commissionType == PartnerCommissionType.CONTRACTUAL) {
|
|
||||||
// if the commission type is contractual, add a [c] to the end of the name
|
|
||||||
return {
|
|
||||||
text: `${target.displayName} [c]`,
|
|
||||||
iconURL:
|
|
||||||
target instanceof GuildMember
|
|
||||||
? target.user.displayAvatarURL()
|
|
||||||
: target.displayAvatarURL(),
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// otherwise, just set the author to the member's display name
|
|
||||||
return {
|
|
||||||
text: target.displayName,
|
|
||||||
iconURL:
|
|
||||||
target instanceof GuildMember
|
|
||||||
? target.user.displayAvatarURL()
|
|
||||||
: target.displayAvatarURL(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue