一、超管端设计优化 - 文档管理SOP体系建立,docs目录重组 - 统一用户管理:跨租户全局视角,合并用户管理+公众用户 - 活动监管全模块重构:全部活动(统计卡片+阶段筛选+SuperDetail详情页)、报名数据/作品数据/评审进度(两层合一扁平列表)、成果发布(去Tab+统计+隐藏写操作) - 菜单精简:移除评委管理/评审规则/通知管理 - Bug修复:租户编辑丢失隐藏菜单、pageSize限制、主色统一 二、UGC绘本创作社区P0 - 数据库:10张新表(user_works/user_work_pages/work_tags等) - 子女账号独立化:Child升级为独立User,家长切换+独立登录 - 用户作品库:CRUD+发布审核,8个API - AI创作流程:提交→生成→保存到作品库,4个API - 作品广场:首页改造为推荐流,标签+搜索+排序 - 内容审核(超管端):作品审核+作品管理+标签管理 - 活动联动:WorkSelector作品选择器 - 布局改造:底部5Tab(发现/创作/活动/作品库/我的) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { ExtractJwt, Strategy } from 'passport-jwt';
|
|
import { PassportStrategy } from '@nestjs/passport';
|
|
import { Injectable } from '@nestjs/common';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { PrismaService } from '../../prisma/prisma.service';
|
|
|
|
@Injectable()
|
|
export class JwtStrategy extends PassportStrategy(Strategy) {
|
|
constructor(
|
|
private configService: ConfigService,
|
|
private prisma: PrismaService,
|
|
) {
|
|
super({
|
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
ignoreExpiration: false,
|
|
secretOrKey: configService.get<string>('JWT_SECRET') || 'your-secret-key',
|
|
});
|
|
}
|
|
|
|
async validate(payload: any) {
|
|
// 查询租户是否为超级租户
|
|
let isSuperTenant = false;
|
|
if (payload.tenantId) {
|
|
const tenant = await this.prisma.tenant.findUnique({
|
|
where: { id: payload.tenantId },
|
|
select: { isSuper: true },
|
|
});
|
|
isSuperTenant = tenant?.isSuper === 1;
|
|
}
|
|
|
|
return {
|
|
userId: payload.sub,
|
|
username: payload.username,
|
|
tenantId: payload.tenantId,
|
|
isSuperTenant,
|
|
userType: payload.userType || 'adult',
|
|
parentUserId: payload.parentUserId || null,
|
|
};
|
|
}
|
|
}
|