feat(admin): batch ops, transfer, watermark, usage and qr share pages

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-20 21:10:30 +08:00
parent 618d1d796c
commit f08d68bebf
31 changed files with 2717 additions and 34 deletions
+18 -4
View File
@@ -43,19 +43,33 @@ export async function loginAsAdmin(page: Page): Promise<void> {
await expect(page).toHaveURL(/\/albums\/manage/, { timeout: 20_000 })
}
/** 直种夹具(seed-fixture.cjs):staff 账号 / 相册种子照片(幂等) */
export function seedFixture(mode: 'staff' | 'photos', ...args: string[]): void {
/** 直种夹具(seed-fixture.cjs):staff 账号 / 相册种子照片 / 治理批量照片 /
* 水印旅程真实对象照片 / 水印任务直驱(详见 seed-fixture.cjs 文件头) */
export function seedFixture(
mode: 'staff' | 'photos' | 'gov-photos' | 'wm-photos' | 'watermark-run',
...args: string[]
): void {
const vars = rootEnv()
const databaseUrl = vars.get('DATABASE_URL_CN')
if (!databaseUrl) {
throw new Error('[admin e2e] 根 .env 缺少 DATABASE_URL_CN')
}
// @photo/db-cn 绝对路径:apps/admin 不依赖该包,借 services/api 的 node_modules
// @photo/db-cn / @photo/storage 绝对路径:apps/admin 不依赖这些包,借
// services/api 的 node_modules(node 从 e2e 目录解析不到 workspace 链接)
const dbCn = join(repoRoot, 'services', 'api', 'node_modules', '@photo', 'db-cn')
const storage = join(repoRoot, 'services', 'api', 'node_modules', '@photo', 'storage')
// 全量根 .env 注入(S3_* 供水印对象直写与 worker 直驱;process.env 覆盖
// 优先级更高——playwright 进程自身的环境变量优先于文件值)
execSync(`node seed-fixture.cjs ${mode} ${args.join(' ')}`, {
cwd: fileURLToPath(new URL('.', import.meta.url)),
stdio: 'inherit',
shell: true,
env: { ...process.env, PHOTO_DB_CN: dbCn, DATABASE_URL_CN: databaseUrl }
env: {
...Object.fromEntries(vars),
...process.env,
PHOTO_DB_CN: dbCn,
PHOTO_STORAGE: storage,
DATABASE_URL_CN: databaseUrl
}
})
}