feat: username login support - recherche par username OU email

This commit is contained in:
Manus Deploy
2026-04-21 06:00:43 -04:00
parent 171386d333
commit 145b3dd971
8 changed files with 792 additions and 41 deletions

View File

@@ -31,7 +31,8 @@ export type InsertUser = typeof users.$inferInsert;
export const localUsers = mysqlTable("local_users", {
id: int("id").autoincrement().primaryKey(),
name: varchar("name", { length: 255 }).notNull(),
email: varchar("email", { length: 320 }).notNull().unique(),
username: varchar("username", { length: 128 }).unique(),
email: varchar("email", { length: 320 }),
passwordHash: varchar("passwordHash", { length: 255 }).notNull(),
role: mysqlEnum("role", ["admin", "user", "readonly"]).default("user").notNull(),
isActive: boolean("isActive").default(true).notNull(),
@@ -115,3 +116,22 @@ export const importLogs = mysqlTable("import_logs", {
export type ImportLog = typeof importLogs.$inferSelect;
export type InsertImportLog = typeof importLogs.$inferInsert;
// ─── Boîte à idées ───────────────────────────────────────────────────────────
export const ideas = mysqlTable("ideas", {
id: int("id").autoincrement().primaryKey(),
userId: int("userId").notNull(),
userName: varchar("userName", { length: 255 }).notNull(),
titre: varchar("titre", { length: 512 }).notNull(),
message: text("message").notNull(),
statut: mysqlEnum("statut", ["ouvert", "en_cours", "resolu", "ferme"]).default("ouvert").notNull(),
reponseAdmin: text("reponseAdmin"),
reponduPar: varchar("reponduPar", { length: 255 }),
reponduAt: timestamp("reponduAt"),
createdAt: timestamp("createdAt").defaultNow().notNull(),
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
});
export type Idea = typeof ideas.$inferSelect;
export type InsertIdea = typeof ideas.$inferInsert;