diff --git a/database/HardInquiry.ts b/database/HardInquiry.ts new file mode 100644 index 0000000..015cbf6 --- /dev/null +++ b/database/HardInquiry.ts @@ -0,0 +1,11 @@ +import { prop, getModelForClass, Ref } from "@typegoose/typegoose" +import Inquiry from "./Inquiry"; + +/** + * HardInquiry is a class which extends Inquiry. + * Structure is performed this way to have two separate collections for Hard and Soft inquiries. + */ +export default class HardInquiry extends Inquiry { + @prop({ required: true }) + public reason: string | undefined; +} diff --git a/database/Inquiry.ts b/database/Inquiry.ts index 9f0e2df..48054ba 100644 --- a/database/Inquiry.ts +++ b/database/Inquiry.ts @@ -1,5 +1,5 @@ import { prop, getModelForClass, Ref } from "@typegoose/typegoose" -import Member, { MemberAdditionalAcknowledgement, MemberUsedLanguages, MemberUsedOperatingSystems } from "./Member"; +import Member from "./Member"; import CommunityReport from "./CommunityReport" /** @@ -11,15 +11,27 @@ import CommunityReport from "./CommunityReport" export default abstract class Inquiry { + @prop({ required: true, unique: true }) + // the Inquiry Identifier (previously known as `iid`). this is an UUIDv4 string + public id: string | undefined; + @prop({ required: true, index: true, ref: () => Member }) + // the member on which this inquiry was performed on public member: Ref | undefined; @prop({ required: true }) + // the date in which this inquiry was performed public date: Date | undefined; @prop({ required: true, ref: () => Member }) + // the reference to the member who initiated this inquiry or a string value representing the name of a system that initiated the inquiry public initiatedBy: Ref | string | undefined; @prop({ required: true, ref: () => CommunityReport }) + // the report that was generated or fetched from this inquiry as of current date public report: Ref | undefined; + + @prop() + // a reason for the inquiry, if applicable. this value is required for HardInquiry + public reason: string | "N/A" | undefined; } diff --git a/database/SoftInquiry.ts b/database/SoftInquiry.ts new file mode 100644 index 0000000..a83d499 --- /dev/null +++ b/database/SoftInquiry.ts @@ -0,0 +1,7 @@ +import Inquiry from "./Inquiry"; + +/** + * SoftInquiry is a class which extends Inquiry. + * Structure is performed this way to have two separate collections for Hard and Soft inquiries. + */ +export default class SoftInquiry extends Inquiry {}