feat: 增加管理员品牌归属关系

This commit is contained in:
que01 committed 2026-09-23 02:10:19 +08:00
1 parent fef0a890ad
commit ee3bd9051b
4 files changed
+52 -2

No files matched your search

+6 -1
View File
@@ -16,10 +16,15 @@ export class AdminAuthService {
where: { id: user.id },
data: { lastLoginAt: new Date() },
});
const membership = await this.prisma.brandMembership.findFirst({
where: { adminUserId: user.id, isEnabled: true },
orderBy: { createdAt: "asc" },
});
if (!membership) throw new UnauthorizedException("账号尚未配置品牌权限");
return {
token: signIdentity({
subject: user.id,
brandId: process.env.DEFAULT_BRAND_ID ?? "",
brandId: membership.brandId,
role: "admin",
}),
displayName: user.displayName,