Add permission and user admin modules with updated user schema

Split user name into first_name/last_name/name and rename phone_number to
phone; add permissions table and register the new permission/user handlers.
This commit is contained in:
2026-07-08 12:48:05 +05:00
parent 4d1942d7fe
commit 4350915b30
13 changed files with 3551 additions and 7 deletions

View File

@@ -1,12 +1,12 @@
CREATE TABLE IF NOT EXISTS users (
"id" bigserial primary key,
"email" character varying(250) NOT NULL DEFAULT '',
"name" character varying(250) NOT NULL DEFAULT '',
"password" character varying(250) NOT NULL DEFAULT '',
"fullname" character varying(250) NOT NULL DEFAULT '',
"first_name" character varying(250) NOT NULL DEFAULT '',
"last_name" character varying(250) NOT NULL DEFAULT '',
"username" character varying(250) NOT NULL DEFAULT '',
"phone_number" character varying(250) NOT NULL DEFAULT '',
"avatar" character varying(250) NOT NULL DEFAULT '',
"social_media" json NOT NULL DEFAULT '{}'::json,
"phone" character varying(250) NOT NULL DEFAULT '',
"light_mode" integer DEFAULT 1 NOT NULL,
"role" character varying(250) NOT NULL DEFAULT 'user',
"active" boolean NOT NULL DEFAULT true,
@@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS users (
);
insert into users(
phone_number, password, fullname, email, role
phone, password, name, email, role
) values (
'61531216',
'$2a$12$8ZbKmoSwna4CASQptM2/SubwvsBUR1YhABULd.2/QJB.13Wi2v55m',
@@ -101,4 +101,13 @@ CREATE TABLE IF NOT EXISTS roles (
guard_name character varying(255) NOT NULL,
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
);
CREATE TABLE IF NOT EXISTS permissions (
id bigserial PRIMARY KEY,
code character varying(255) NOT NULL DEFAULT '',
name character varying(255) NOT NULL,
guard_name character varying(255) NOT NULL,
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL
);