Skip to content

Commit

Permalink
chore(schema): move comments to only be used in invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianAndersen committed Dec 26, 2024
1 parent 3848f27 commit dbf1f9f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export class CustomerItemGenerateReportOperation implements Operation {
guardianPhone: { $first: "$customerInfo.guardian.phone" },
guardianName: { $first: "$customerInfo.guardian.name" },
handoutEmployee: { $first: "$employeeInfo.name" },
comments: 1,
pivot: "1",
},
},
Expand Down
13 changes: 13 additions & 0 deletions backend/src/collections/invoice/invoice.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,17 @@ export const invoiceSchema = new Schema<ToSchema<Invoice>>({
ourReference: String,
invoiceId: String,
reference: String,
comments: {
type: [
{
id: String,
msg: String,
creationTime: {
type: Date,
default: Date.now(),
},
user: Schema.Types.ObjectId,
},
],
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe("ItemValidator", () => {
categories: [],
creationTime: new Date(),
lastUpdated: new Date(),
comments: [],
active: true,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe("OrderHookBefore", () => {
branch: "b1",
byCustomer: true,
payments: ["payment1"],
comments: [],
active: false,
user: {
id: "u1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ describe("OrderPostHook", () => {
byCustomer: true,
payments: [],
delivery: "",
comments: [],
active: false,
user: {
id: "u1",
Expand Down
1 change: 0 additions & 1 deletion backend/src/payment/dibs/dibs-payment.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ describe("DibsPaymentService", () => {
},
],
payments: [],
comments: [],
delivery: "",
active: false,
user: {
Expand Down
13 changes: 0 additions & 13 deletions backend/src/storage/mongoDb/mongoose-schema-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@ export class MongooseModelCreator<T> {
private standardizeSchema(schema: Schema): Schema {
schema.add({
blid: String,
comments: {
type: [
{
id: String,
msg: String,
creationTime: {
type: Date,
default: Date.now(),
},
user: Schema.Types.ObjectId,
},
],
},
active: {
type: Boolean,
default: true,
Expand Down
2 changes: 0 additions & 2 deletions shared/src/bl-document/bl-document.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Comment } from "@shared/comment/comment";
import { UserPermission } from "@shared/permission/user-permission";

export interface BlDocument {
id: string;
blid?: string;
lastUpdated?: Date;
creationTime?: Date;
comments?: Comment[];
active?: boolean;
user?: {
// the user that created the document
Expand Down
2 changes: 2 additions & 0 deletions shared/src/invoice/invoice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BlDocument } from "@shared/bl-document/bl-document";
import { Comment } from "@shared/comment/comment";
import { CustomerItemType } from "@shared/customer-item/customer-item-type";

export interface Invoice extends BlDocument {
Expand Down Expand Up @@ -62,4 +63,5 @@ export interface Invoice extends BlDocument {
ourReference?: string;
invoiceId?: string; // ex. 201810000
reference?: string; // ex. 'Not delivered books in time'
comments?: Comment[];
}
2 changes: 0 additions & 2 deletions shared/src/match/match.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BlDocument } from "@shared/bl-document/bl-document";
import { Comment } from "@shared/comment/comment";
import { UserPermission } from "@shared/permission/user-permission";

export enum MatchVariant {
Expand All @@ -19,7 +18,6 @@ export class MatchBase implements BlDocument {
blid?: string;
lastUpdated?: Date;
creationTime?: Date;
comments?: Comment[];
active?: boolean;
user?: {
id: string;
Expand Down

0 comments on commit dbf1f9f

Please sign in to comment.