城市合伙人端的修改(后台)
This commit is contained in:
@@ -152,15 +152,22 @@ export class PartnerMeController {
|
||||
async me(@CurrentUser() user: AuthUser) {
|
||||
const account = await this.prisma.partnerAccount.findUniqueOrThrow({
|
||||
where: { id: user.actorId },
|
||||
include: { partner: true },
|
||||
});
|
||||
let primary = account;
|
||||
if (account.isPrimary !== 1 && account.parentAccountId) {
|
||||
primary = await this.prisma.partnerAccount.findUniqueOrThrow({
|
||||
where: { id: account.parentAccountId },
|
||||
});
|
||||
}
|
||||
return {
|
||||
id: account.id.toString(),
|
||||
name: account.name,
|
||||
phone: account.phone,
|
||||
isPrimary: account.isPrimary === 1,
|
||||
staffRole: account.staffRole ?? undefined,
|
||||
companyName: account.partner.companyName,
|
||||
permissions: Array.isArray(account.permissions) ? account.permissions : undefined,
|
||||
primaryAccountId: primary.id.toString(),
|
||||
companyName: primary.companyName ?? undefined,
|
||||
hasWechat: !!account.wxOpenId,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user