refactor(structure): promote app to repo root + remove redundant workspace cruft
Standard production layout: the OKR app (was nested under AINative_OKR_CASAN5/) is now
the repository root. No more wrapper directory.
- Promote AINative_OKR_CASAN5/* -> repo root (backend/ frontend/ packages/ apps/
.specify/ docs/ infra/ nginx/ scripts/ + configs). Merge tool dirs: .gitea (kept the
active deploy ci.yml, added harness-ci.yml + runbooks), .claude (agents/commands +
launch.json), .github moved up.
- Remove redundant: 00_SUBMISSION_PACKAGE, scattered root notes (FPT_CASAN_Full.md,
tu-tuong-casan.md, casan-tu-sinh..., casan_harness_assessment.md, source-review...,
README_CASAN5_REFINED.md), casan-next-plans/ and optimize-docs/ (competition/planning
artifacts — roadmap + design history preserved in git log / commit messages).
- Update all references to the old layout:
- .gitea/workflows/{ci,harness-ci}.yml, .github/workflows/{ci,deploy}.yml:
working-directory .; drop AINative_OKR_CASAN5/ prefix; .specify/{tests,scripts}
-> packages/casan-harness/... (.specify/logs state kept)
- .claude/launch.json, .gitea/*-runbook.md: path prefixes
- CLAUDE.md, README.md: docs/input -> apps/okr/domain/input
- policy-bundle.yaml: 8 policy paths -> packages/casan-harness/...; manifest re-signed
- secrets-scan.sh: fixture excludes -> new package/domain paths.
Full gate from the new root: PASS=64 FAIL=0 SKIP=3.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7101af9fd4
commit
36a4812ef3
@@ -0,0 +1,205 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import bcrypt from 'bcryptjs';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const passwordHash = await bcrypt.hash('Password@123', 12);
|
||||
|
||||
const admin = await prisma.user.upsert({
|
||||
where: { email: 'admin@okr.local' },
|
||||
update: { passwordHash },
|
||||
create: {
|
||||
name: 'System Admin',
|
||||
username: 'admin',
|
||||
email: 'admin@okr.local',
|
||||
passwordHash,
|
||||
role: 'ADMIN',
|
||||
},
|
||||
});
|
||||
|
||||
const manager = await prisma.user.upsert({
|
||||
where: { email: 'manager@okr.local' },
|
||||
update: { passwordHash },
|
||||
create: {
|
||||
name: 'Nguyen Van Manager',
|
||||
username: 'manager',
|
||||
email: 'manager@okr.local',
|
||||
passwordHash,
|
||||
role: 'MANAGER',
|
||||
},
|
||||
});
|
||||
|
||||
const employee = await prisma.user.upsert({
|
||||
where: { email: 'employee@okr.local' },
|
||||
update: { passwordHash },
|
||||
create: {
|
||||
name: 'Nguyen Van A',
|
||||
username: 'employee',
|
||||
email: 'employee@okr.local',
|
||||
passwordHash,
|
||||
role: 'EMPLOYEE',
|
||||
},
|
||||
});
|
||||
|
||||
const employeeTwo = await prisma.user.upsert({
|
||||
where: { email: 'employee2@okr.local' },
|
||||
update: { passwordHash },
|
||||
create: {
|
||||
name: 'Tran Thi B',
|
||||
username: 'employee2',
|
||||
email: 'employee2@okr.local',
|
||||
passwordHash,
|
||||
role: 'EMPLOYEE',
|
||||
},
|
||||
});
|
||||
|
||||
const securityObjective = await prisma.objective.upsert({
|
||||
where: { id: 1 },
|
||||
update: {
|
||||
ownerId: employee.id,
|
||||
title: 'POC AI for SQL Injection prevention',
|
||||
description: 'Evaluate AI tools for automated SQL injection detection.',
|
||||
quarter: 'Q2/2026',
|
||||
status: 'IN_PROGRESS',
|
||||
},
|
||||
create: {
|
||||
id: 1,
|
||||
ownerId: employee.id,
|
||||
title: 'POC AI for SQL Injection prevention',
|
||||
description: 'Evaluate AI tools for automated SQL injection detection.',
|
||||
quarter: 'Q2/2026',
|
||||
status: 'IN_PROGRESS',
|
||||
},
|
||||
});
|
||||
|
||||
const adoptionObjective = await prisma.objective.upsert({
|
||||
where: { id: 2 },
|
||||
update: {
|
||||
ownerId: employeeTwo.id,
|
||||
title: 'AI for All enablement across department',
|
||||
description: 'Train and certify department members on practical AI workflows.',
|
||||
quarter: 'Q2/2026',
|
||||
status: 'NOT_STARTED',
|
||||
},
|
||||
create: {
|
||||
id: 2,
|
||||
ownerId: employeeTwo.id,
|
||||
title: 'AI for All enablement across department',
|
||||
description: 'Train and certify department members on practical AI workflows.',
|
||||
quarter: 'Q2/2026',
|
||||
status: 'NOT_STARTED',
|
||||
},
|
||||
});
|
||||
|
||||
const managerObjective = await prisma.objective.upsert({
|
||||
where: { id: 3 },
|
||||
update: {
|
||||
ownerId: manager.id,
|
||||
title: 'Improve OKR operating cadence',
|
||||
description: 'Create weekly progress rhythm and reduce stale OKRs.',
|
||||
quarter: 'Q2/2026',
|
||||
status: 'IN_PROGRESS',
|
||||
},
|
||||
create: {
|
||||
id: 3,
|
||||
ownerId: manager.id,
|
||||
title: 'Improve OKR operating cadence',
|
||||
description: 'Create weekly progress rhythm and reduce stale OKRs.',
|
||||
quarter: 'Q2/2026',
|
||||
status: 'IN_PROGRESS',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.keyResult.upsert({
|
||||
where: { id: 1 },
|
||||
update: { objectiveId: securityObjective.id, progress: 33 },
|
||||
create: {
|
||||
id: 1,
|
||||
objectiveId: securityObjective.id,
|
||||
title: 'Complete 3 POC sessions with security team',
|
||||
progress: 33,
|
||||
startValue: 0,
|
||||
targetValue: 3,
|
||||
deadline: new Date('2026-06-30T00:00:00.000Z'),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.keyResult.upsert({
|
||||
where: { id: 2 },
|
||||
update: { objectiveId: securityObjective.id, progress: 60 },
|
||||
create: {
|
||||
id: 2,
|
||||
objectiveId: securityObjective.id,
|
||||
title: 'Reduce manual SQL injection review effort by 30%',
|
||||
progress: 60,
|
||||
startValue: 0,
|
||||
targetValue: 30,
|
||||
deadline: new Date('2026-06-30T00:00:00.000Z'),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.keyResult.upsert({
|
||||
where: { id: 3 },
|
||||
update: { objectiveId: adoptionObjective.id, progress: 0 },
|
||||
create: {
|
||||
id: 3,
|
||||
objectiveId: adoptionObjective.id,
|
||||
title: 'Certify 100 department members on AI for All',
|
||||
progress: 0,
|
||||
startValue: 0,
|
||||
targetValue: 100,
|
||||
deadline: new Date('2026-06-30T00:00:00.000Z'),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.keyResult.upsert({
|
||||
where: { id: 4 },
|
||||
update: { objectiveId: managerObjective.id, progress: 75 },
|
||||
create: {
|
||||
id: 4,
|
||||
objectiveId: managerObjective.id,
|
||||
title: 'Reach 90% weekly OKR update compliance',
|
||||
progress: 75,
|
||||
startValue: 40,
|
||||
targetValue: 90,
|
||||
deadline: new Date('2026-06-30T00:00:00.000Z'),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.keyResult.upsert({
|
||||
where: { id: 5 },
|
||||
update: { objectiveId: managerObjective.id, progress: 45 },
|
||||
create: {
|
||||
id: 5,
|
||||
objectiveId: managerObjective.id,
|
||||
title: 'Resolve stale OKR reports within two business days',
|
||||
progress: 45,
|
||||
startValue: 0,
|
||||
targetValue: 10,
|
||||
deadline: new Date('2026-06-30T00:00:00.000Z'),
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.progressUpdate.deleteMany({ where: { keyResultId: { in: [1, 2, 3, 4, 5] } } });
|
||||
await prisma.progressUpdate.create({
|
||||
data: {
|
||||
keyResultId: 2,
|
||||
progress: 60,
|
||||
comment: 'Two review workflows automated; third is in validation.',
|
||||
createdById: employee.id,
|
||||
},
|
||||
});
|
||||
|
||||
void admin;
|
||||
console.log('Seed completed successfully.');
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((error: unknown) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user