mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-16 11:49:18 +02:00
feat: implement user authentication and authorization with NextAuth, including user schema, password hashing, and role-based access control.
This commit is contained in:
1 parent
c842c2447a
commit
359d196c4d
18 files changed
+652
-32
No files matched your search
+14
-1
@@ -1,4 +1,4 @@
|
||||
import { pgTable, serial, varchar, numeric, smallint, timestamp, uniqueIndex, index, text, jsonb } from "drizzle-orm/pg-core";
|
||||
import { pgTable, serial, varchar, numeric, smallint, timestamp, uniqueIndex, index, text, jsonb, integer } from "drizzle-orm/pg-core";
|
||||
|
||||
export const ventesProduits = pgTable("ventes_produits", {
|
||||
id: serial("id").primaryKey(),
|
||||
@@ -47,9 +47,22 @@ export const ventesProduits = pgTable("ventes_produits", {
|
||||
];
|
||||
});
|
||||
|
||||
/** User management (Epic 6) */
|
||||
export const users = pgTable("users", {
|
||||
id: serial("id").primaryKey(),
|
||||
username: varchar("username", { length: 50 }).notNull().unique(),
|
||||
/** Hashed password */
|
||||
passwordHash: text("password_hash").notNull(),
|
||||
/** 'admin' or 'user' */
|
||||
role: varchar("role", { length: 20 }).default("user").notNull(),
|
||||
createdAt: timestamp("created_at").defaultNow(),
|
||||
});
|
||||
|
||||
/** Snapshot of a complete arbitrage session (Epic 5) */
|
||||
export const sessionSnapshots = pgTable("session_snapshots", {
|
||||
id: serial("id").primaryKey(),
|
||||
/** Link to user who created the snapshot */
|
||||
userId: integer("user_id").references(() => users.id),
|
||||
codeFournisseur: varchar("code_fournisseur", { length: 20 }).notNull(),
|
||||
nomFournisseur: varchar("nom_fournisseur", { length: 255 }),
|
||||
magasin: varchar("magasin", { length: 20 }).notNull(),
|
||||
|
||||
Reference in new issue
Block a user