Update Dockerfile and package.json to use Prisma migrations, add bcryptjs and next-auth dependencies, and enhance README instructions for database setup. Refactor Prisma schema to include password hashing for users and implement evaluation sharing functionality. Improve admin page with user management features and integrate session handling for authentication. Enhance evaluation detail page with sharing options and update API routes for access control based on user roles.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 3m4s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 3m4s
This commit is contained in:
@@ -434,15 +434,18 @@ async function main() {
|
||||
});
|
||||
if (!template) throw new Error("Template not found");
|
||||
|
||||
await prisma.user.upsert({
|
||||
where: { email: "admin@cars-front.local" },
|
||||
create: {
|
||||
email: "admin@cars-front.local",
|
||||
name: "Admin User",
|
||||
role: "admin",
|
||||
},
|
||||
update: {},
|
||||
});
|
||||
const bcrypt = require("bcryptjs");
|
||||
const adminHash = bcrypt.hashSync("admin123", 10);
|
||||
const admin = await prisma.user.upsert({
|
||||
where: { email: "admin@cars-front.local" },
|
||||
create: {
|
||||
email: "admin@cars-front.local",
|
||||
name: "Admin User",
|
||||
passwordHash: adminHash,
|
||||
role: "admin",
|
||||
},
|
||||
update: { passwordHash: adminHash },
|
||||
});
|
||||
|
||||
const dims = await prisma.templateDimension.findMany({
|
||||
where: { templateId: template.id },
|
||||
@@ -485,6 +488,7 @@ async function main() {
|
||||
candidateRole: r.role,
|
||||
candidateTeam: r.team,
|
||||
evaluatorName: r.evaluator,
|
||||
evaluatorId: admin.id,
|
||||
evaluationDate: new Date(2025, 1, 15 + i),
|
||||
templateId: template.id,
|
||||
status: i === 0 ? "submitted" : "draft",
|
||||
@@ -526,6 +530,13 @@ async function main() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Rattacher les évaluations orphelines (sans evaluatorId) à l'admin
|
||||
await prisma.evaluation.updateMany({
|
||||
where: { evaluatorId: null },
|
||||
data: { evaluatorId: admin.id },
|
||||
});
|
||||
|
||||
console.log("Seed complete: templates synced, répondants upserted (évaluations non vidées)");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user