Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from matejbucek/master
Browse files Browse the repository at this point in the history
Resolving the Mongoose Populate issue.
  • Loading branch information
lukynmatuska authored Aug 26, 2022
2 parents 1d16ccd + 2ba3bee commit 654f606
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
19 changes: 4 additions & 15 deletions src/services/Ticket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ export class TicketService {
let doc = new this.model(obj);
await doc.save();
doc = await doc
.populate("owner")
//@ts-ignore
.populate("year")
.populate("time")
.execPopulate();
.populate(["owner", "year", "time"])
this.wss.broadcast("new-ticket", doc);

// this.nodemailerService.sendTestMail();
return doc;
}
Expand Down Expand Up @@ -106,11 +103,7 @@ export class TicketService {
});
await doc.save();
doc = await doc
.populate("owner")
//@ts-ignore
.populate("year")
.populate("time")
.execPopulate();
.populate(["owner", "year", "time"])
this.wss.broadcast("new-ticket", doc);
await this.nodemailerService.sendAndParse(
// @ts-ignore
Expand Down Expand Up @@ -181,11 +174,7 @@ export class TicketService {

obj.save();
let res = await obj
.populate("owner")
//@ts-ignore
.populate("year")
.populate("time")
.execPopulate();
.populate(["owner", "year", "time"])
this.wss.broadcast("update-ticket", res);
return res;
}
Expand Down
4 changes: 0 additions & 4 deletions src/services/Year.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export class YearService {
await doc.save()
doc = await doc
.populate("times")
//@ts-ignore
.execPopulate();
this.wss.broadcast("new-year", doc);
return doc;
}
Expand Down Expand Up @@ -73,8 +71,6 @@ export class YearService {
obj.save();
let res = await obj
.populate("times")
//@ts-ignore
.execPopulate()
this.wss.broadcast("update-year", res);
return res;
}
Expand Down

0 comments on commit 654f606

Please sign in to comment.