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