return populated fields on rts create
This commit is contained in:
@@ -21,7 +21,7 @@ export async function createRts(
|
||||
defaultClient = userInDb.orgId.toString();
|
||||
}
|
||||
|
||||
return await rtsModel.create({
|
||||
const newRts = await rtsModel.create({
|
||||
...input,
|
||||
tenantId: user.tenantId,
|
||||
pid: generateId(),
|
||||
@@ -29,6 +29,13 @@ export async function createRts(
|
||||
createdAt: new Date(),
|
||||
createdBy: user.userId ?? null,
|
||||
});
|
||||
|
||||
return rtsModel
|
||||
.findById(newRts.id)
|
||||
.populate({ path: "county", select: "pid name avatar" })
|
||||
.populate({ path: "client", select: "pid name avatar" })
|
||||
.populate({ path: "createdBy", select: "pid name avatar" })
|
||||
.populate({ path: "assignedTo", select: "pid name avatar" });
|
||||
}
|
||||
|
||||
export async function getRts(id: string, tenantId: string) {
|
||||
|
||||
Reference in New Issue
Block a user