multiple changes in sql schema
This commit is contained in:
parent
63b9813012
commit
04cb5934ad
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.2.0, 2017-02-23T16:12:21. -->
|
<!-- Written by QtCreator 4.2.0, 2017-03-01T08:45:15. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
|||||||
332
sql/schema.sql
332
sql/schema.sql
@ -25,60 +25,13 @@ END;
|
|||||||
$$ language 'plpgsql';
|
$$ language 'plpgsql';
|
||||||
|
|
||||||
|
|
||||||
CREATE or replace FUNCTION change_trigger()
|
|
||||||
RETURNS trigger AS $$
|
|
||||||
BEGIN
|
|
||||||
IF TG_OP = 'INSERT'
|
|
||||||
THEN
|
|
||||||
INSERT INTO logging.t_history (tabname, schemaname, operation, new_val)
|
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(NEW));
|
|
||||||
RETURN NEW;
|
|
||||||
|
|
||||||
ELSIF TG_OP = 'UPDATE'
|
|
||||||
THEN
|
|
||||||
INSERT INTO logging.t_history (tabname, schemaname, operation, new_val, old_val)
|
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP,
|
|
||||||
row_to_json(NEW), row_to_json(OLD));
|
|
||||||
RETURN NEW;
|
|
||||||
|
|
||||||
ELSIF TG_OP = 'DELETE'
|
|
||||||
THEN
|
|
||||||
INSERT INTO logging.t_history (tabname, schemaname, operation, old_val)
|
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(OLD));
|
|
||||||
RETURN OLD;
|
|
||||||
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE 'plpgsql' SECURITY DEFINER;
|
|
||||||
|
|
||||||
|
|
||||||
--create types
|
|
||||||
DO $$
|
|
||||||
BEGIN
|
|
||||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'parameter_type') THEN
|
|
||||||
create TYPE parameter_type AS ENUM
|
|
||||||
( 'stored','pointed');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'privilege_role') THEN
|
|
||||||
-- create TYPE privilege_role AS ENUM
|
|
||||||
-- ();
|
|
||||||
-- END IF;
|
|
||||||
|
|
||||||
-- IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'privilege_type') THEN
|
|
||||||
-- create TYPE privilege_type AS ENUM
|
|
||||||
-- ();
|
|
||||||
-- END IF;
|
|
||||||
--more types here...
|
|
||||||
END$$;
|
|
||||||
|
|
||||||
drop table if exists "user" cascade;
|
drop table if exists "user" cascade;
|
||||||
drop table if exists "auth_info" cascade;
|
drop table if exists "auth_info" cascade;
|
||||||
drop table if exists "auth_token" cascade;
|
drop table if exists "auth_token" cascade;
|
||||||
drop table if exists "user_action" cascade;
|
drop table if exists "user_audit_action" cascade;
|
||||||
drop table if exists "user_history" cascade;
|
drop table if exists "user_audit" cascade;
|
||||||
drop table if exists stat cascade;
|
drop table if exists "stat" cascade;
|
||||||
|
drop table if exists "user_groups" cascade;
|
||||||
drop table if exists action cascade;
|
drop table if exists action cascade;
|
||||||
drop table if exists metric_systems cascade;
|
drop table if exists metric_systems cascade;
|
||||||
drop table if exists measurands cascade;
|
drop table if exists measurands cascade;
|
||||||
@ -98,21 +51,98 @@ drop table if exists system_info;
|
|||||||
drop table if exists user_inventory;
|
drop table if exists user_inventory;
|
||||||
|
|
||||||
create table "system_info"(
|
create table "system_info"(
|
||||||
"id" serial not null,
|
"id" serial not null,
|
||||||
"name" text,
|
"name" text,
|
||||||
"value" jsonb,
|
"value" jsonb,
|
||||||
"creation_time" timestamp,
|
"when" timestamp,
|
||||||
constraint "pk_system_info" primary key ("id")
|
constraint "pk_system_info" primary key ("id")
|
||||||
);
|
);
|
||||||
create index "ix_system_info_name" on "system_info"("name") with ( FILLFACTOR=100 );
|
create index "ix_system_info_name" on "system_info"("name") with ( FILLFACTOR=100 );
|
||||||
comment on table "system_info" is 'table introduced to save information about system e.g. actual db version / application version etc';
|
comment on table "system_info" is 'table introduced to save information about system e.g. actual db version / application version etc';
|
||||||
comment on column "system_info"."name" is '';
|
comment on column "system_info"."name" is '';
|
||||||
comment on column "system_info"."value" is '';
|
comment on column "system_info"."value" is '';
|
||||||
|
|
||||||
|
create table "group" (
|
||||||
|
"gid" serial not null,
|
||||||
|
"name" text not null,
|
||||||
|
"description" text,
|
||||||
|
"created" timestamp DEFAULT now() not null,
|
||||||
|
"updated" timestamp,
|
||||||
|
constraint "pk_group_gid" primary key ("gid"),
|
||||||
|
constraint "ux_group_name" unique ("name")
|
||||||
|
);
|
||||||
|
create trigger "update_user_group_last_update" before update on "group" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
||||||
|
insert into "group"("name") values ('nogroup'), ('admins'), ('moderators'), ('users');
|
||||||
|
|
||||||
|
create or replace function default_group_id()
|
||||||
|
returns int as $$
|
||||||
|
declare id integer;
|
||||||
|
BEGIN
|
||||||
|
SELECT "group"."gid" FROM "group" WHERE "group"."name" = 'nogroup' limit 1 into id;
|
||||||
|
return id;
|
||||||
|
end $$
|
||||||
|
language 'plpgsql';
|
||||||
|
|
||||||
|
create or replace function default_users_group_id()
|
||||||
|
returns int as $$
|
||||||
|
declare id integer;
|
||||||
|
BEGIN
|
||||||
|
SELECT "group"."gid" FROM "group" WHERE "group"."name" = 'users' limit 1 into id;
|
||||||
|
return id;
|
||||||
|
end $$
|
||||||
|
language 'plpgsql';
|
||||||
|
|
||||||
|
create or replace function default_admins_group_id()
|
||||||
|
returns int as $$
|
||||||
|
declare id integer;
|
||||||
|
BEGIN
|
||||||
|
SELECT "group"."gid" FROM "group" WHERE "group"."name" = 'admins' limit 1 into id;
|
||||||
|
return id;
|
||||||
|
end $$
|
||||||
|
language 'plpgsql';
|
||||||
|
|
||||||
|
create table "user" (
|
||||||
|
"uid" serial not null,
|
||||||
|
"group" int not null default default_users_group_id(),
|
||||||
|
"status" int not null default 0,
|
||||||
|
"full_name" text not null,
|
||||||
|
"created" timestamp DEFAULT now() not null,
|
||||||
|
"updated" timestamp,
|
||||||
|
"config" json not null DEFAULT ('{}'),
|
||||||
|
"auth_info_id" bigint,
|
||||||
|
constraint "pk_user_uid" primary key ("uid")
|
||||||
|
);
|
||||||
|
create trigger "update_user_updated" before update on "user" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
||||||
|
|
||||||
|
|
||||||
|
create table "stat"(
|
||||||
|
"id" serial not null,
|
||||||
|
"owner" int not null default 1,
|
||||||
|
"group" int not null default default_group_id(),
|
||||||
|
"unixperms" int not null default unix_to_numeric('764'),
|
||||||
|
"status" int not null default 0,
|
||||||
|
"name" text not null,
|
||||||
|
"created" timestamp DEFAULT now() not null,
|
||||||
|
"updated" timestamp,
|
||||||
|
constraint "pk_stat" primary key ("id"),
|
||||||
|
constraint "fk_stat_user" foreign key ("owner") references "user" ("uid") on delete cascade deferrable initially deferred,
|
||||||
|
constraint "fk_stat_primary_group" foreign key ("group") references "group" ("gid") on delete cascade deferrable initially deferred
|
||||||
|
);
|
||||||
|
create trigger update_stat_last_update before update on stat FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
||||||
|
comment on table "stat" is '';
|
||||||
|
comment on column "stat"."id" is 'unique id for all objects in database';
|
||||||
|
comment on column "stat"."owner" is 'uid of object''s owner';
|
||||||
|
comment on column "stat"."group" is 'groups of object';
|
||||||
|
comment on column "stat"."unixperms" is 'Unixpermissions';
|
||||||
|
comment on column "stat"."status" is 'status in which object is in (login, logout, removed etc)';
|
||||||
|
comment on column "stat"."name" is '';
|
||||||
|
comment on column "stat"."created" is '';
|
||||||
|
comment on column "stat"."updated" is '';
|
||||||
|
|
||||||
|
|
||||||
create table "action"(
|
create table "action"(
|
||||||
"title" text NOT NULL check( length(title) >= 3 AND length(title) < 100 ),
|
"title" text not null check( length(title) >= 3 AND length(title) < 100 ),
|
||||||
"apply_object" boolean NOT NULL,
|
"apply_object" boolean not null,
|
||||||
constraint "pk_action" primary key ("title", "apply_object")
|
constraint "pk_action" primary key ("title", "apply_object")
|
||||||
);
|
);
|
||||||
comment on table "action" is '';
|
comment on table "action" is '';
|
||||||
@ -120,32 +150,16 @@ comment on column "action"."title" is 'column contains name of action';
|
|||||||
comment on column "action"."apply_object" is 'column specifies whether an action applies to objects or tables. Certain actions, like “create,” apply only to tables. I find the system is easier to manage if I choose my actions so they can only apply to one or the other, not both.';
|
comment on column "action"."apply_object" is 'column specifies whether an action applies to objects or tables. Certain actions, like “create,” apply only to tables. I find the system is easier to manage if I choose my actions so they can only apply to one or the other, not both.';
|
||||||
|
|
||||||
|
|
||||||
create table "stat"(
|
|
||||||
"uid" serial not null,
|
|
||||||
"owner" int not null default 1,
|
|
||||||
"group" int not null default 2, -- 1 is a root usergroup, 2 is 'users' set as default
|
|
||||||
"unixperms" int not null default unix_to_numeric('764'),
|
|
||||||
"status" int not null default 0,
|
|
||||||
"name" text NOT NULL check( length(name) < 4096 ),
|
|
||||||
"creation_date" timestamp DEFAULT now() NOT NULL,
|
|
||||||
"last_update" timestamp,
|
|
||||||
constraint "pk_stat" primary key ("uid")
|
|
||||||
);
|
|
||||||
create trigger update_stat_last_update before update on stat FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
|
||||||
comment on table "stat" is '';
|
|
||||||
comment on column "stat"."uid" is 'unique uid for all objects in database';
|
|
||||||
comment on column "stat"."owner" is 'uid of object''s owner';
|
|
||||||
comment on column "stat"."group" is 'groups of object';
|
|
||||||
comment on column "stat"."unixperms" is 'Unixpermissions';
|
|
||||||
comment on column "stat"."status" is 'status in which object is in (login, logout, removed etc)';
|
|
||||||
|
|
||||||
|
|
||||||
create table "implemented_action"(
|
create table "implemented_action"(
|
||||||
"table_name" text not null,
|
"table_name" text not null,
|
||||||
"action" text not null,
|
"action" text not null,
|
||||||
"status" int not null,
|
"status" int not null,
|
||||||
constraint "pk_implemented_action" primary key ("table_name", "action", "status")
|
constraint "pk_implemented_action" primary key ("table_name", "action", "status")
|
||||||
);
|
);
|
||||||
|
comment on table "implemented_action" is '';
|
||||||
|
comment on column "implemented_action"."table_name" is '';
|
||||||
|
comment on column "implemented_action"."action" is '';
|
||||||
|
comment on column "implemented_action"."status" is '';
|
||||||
|
|
||||||
|
|
||||||
create table "privilege" (
|
create table "privilege" (
|
||||||
@ -170,65 +184,20 @@ comment on column "privilege"."related_table_name" is 'holds the name of the ta
|
|||||||
comment on column "privilege"."related_object_uid" is 'stores the ID of the object to which the privilege applies, if it’s an object privilege. This has no meaning for table and global privileges, of course. The one applies to a table, not an object, and the second applies to all rows in a table, so an ID is immaterial. This is also not used for self privileges, because by definition a self privilege has to apply to the user requesting permission to do something.';
|
comment on column "privilege"."related_object_uid" is 'stores the ID of the object to which the privilege applies, if it’s an object privilege. This has no meaning for table and global privileges, of course. The one applies to a table, not an object, and the second applies to all rows in a table, so an ID is immaterial. This is also not used for self privileges, because by definition a self privilege has to apply to the user requesting permission to do something.';
|
||||||
|
|
||||||
|
|
||||||
create table "user" (
|
|
||||||
"address" text,
|
|
||||||
"config" json DEFAULT ('{}'),
|
|
||||||
"avatar" text,
|
|
||||||
"email" varchar(256) not null,
|
|
||||||
constraint "pk_user_uid" primary key ("uid"),
|
|
||||||
constraint "ux_user_name" unique ("name"),
|
|
||||||
constraint "ux_user_email" unique ("email")
|
|
||||||
) INHERITS (stat);
|
|
||||||
create trigger "update_user_last_update" before update on "user" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
|
||||||
|
|
||||||
|
|
||||||
create table "user_action" (
|
|
||||||
"id" serial not null,
|
|
||||||
"name" text,
|
|
||||||
constraint "pk_user_action" primary key ("id"),
|
|
||||||
constraint "ux_user_action_name" unique ("name" )
|
|
||||||
);
|
|
||||||
comment on table "user_action" is 'action that user can take (like login/logout/config change?)';
|
|
||||||
comment on column "user_action"."name" is 'action name';
|
|
||||||
|
|
||||||
|
|
||||||
create table "user_history" (
|
|
||||||
"id" serial not null,
|
|
||||||
"user_id" int not null,
|
|
||||||
"action_id" int not null,
|
|
||||||
"data" jsonb,
|
|
||||||
"when" timestamp DEFAULT(now()),
|
|
||||||
constraint "pk_user_history_id" primary key ("id"),
|
|
||||||
constraint "fk_user_history_user_uid" foreign key ("user_id") references "user"("uid") on delete cascade deferrable initially deferred,
|
|
||||||
constraint "fk_user_history_user_action" foreign key ("action_id") references "user_action"("id") on delete cascade deferrable initially deferred
|
|
||||||
);
|
|
||||||
create index "ix_user_history_data" ON "user_history" ((("data" ->> 'status')::text)) WHERE ("data" ->> 'status') IS NOT NULL;
|
|
||||||
comment on table "user_history" IS 'saves user actions like login/logout';
|
|
||||||
comment on column "user_history"."data" is 'data column contains information about taken action (if login was successful? if not, from what ip this action was taken?)';
|
|
||||||
/*
|
|
||||||
get last login
|
|
||||||
select t.id from user_history t where t.action_id = 1 and t.user_id = 2 and t.data->>'status' = 'success' order by t.id desc limit 1
|
|
||||||
|
|
||||||
get faild attempts
|
|
||||||
select count(*)
|
|
||||||
from user_history t
|
|
||||||
inner join user_action on t.action_id = user_action.id
|
|
||||||
where t.user_id = 2 and user_action.name = 'login' and t.data->>'status'= 'failed' and t.id > (select t.id from user_history t where t.action_id = 1 and t.user_id = 2 and t.data->>'status' = 'success' order by t.id desc limit 1)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
create table "auth_info" (
|
create table "auth_info" (
|
||||||
"id" serial not null,
|
"id" serial not null,
|
||||||
"user_uid" bigint,
|
"user_uid" integer,
|
||||||
"password_hash" varchar(100) not null,
|
"password_hash" varchar(100) not null,
|
||||||
"password_method" varchar(20) not null,
|
"password_method" varchar(20) not null,
|
||||||
"password_salt" varchar(20) not null,
|
"password_salt" varchar(20) not null,
|
||||||
"unverified_email" varchar(256) not null,
|
"email" varchar(256) not null,
|
||||||
"email_token" varchar(64) not null,
|
"email_verified" boolean not null default false,
|
||||||
|
"email_token" varchar(64),
|
||||||
"email_token_expires" timestamp,
|
"email_token_expires" timestamp,
|
||||||
"email_token_role" integer not null,
|
"email_token_role" integer,
|
||||||
constraint "pk_auth_into_id" primary key("id"),
|
constraint "pk_auth_into_id" primary key("id"),
|
||||||
constraint "fk_auth_info_user_uid" foreign key ("user_uid") references "user" ("uid") on delete cascade deferrable initially deferred
|
constraint "fk_auth_info_user_uid" foreign key ("user_uid") references "user" ("uid") on delete cascade deferrable initially deferred,
|
||||||
|
constraint "ux_auth_info_email" unique ("email")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -253,6 +222,42 @@ create table "auth_token" (
|
|||||||
create index "ix_auth_token_value" ON "auth_token" ("value");
|
create index "ix_auth_token_value" ON "auth_token" ("value");
|
||||||
|
|
||||||
|
|
||||||
|
create table "user_audit_action" (
|
||||||
|
"id" serial not null,
|
||||||
|
"name" text,
|
||||||
|
constraint "pk_user_audit_action_id" primary key ("id"),
|
||||||
|
constraint "ux_user_audit_action_name" unique ("name" )
|
||||||
|
);
|
||||||
|
comment on table "user_audit_action" is 'action that user can take (like login/logout/config change?)';
|
||||||
|
comment on column "user_audit_action"."id" is '';
|
||||||
|
comment on column "user_audit_action"."name" is 'action name';
|
||||||
|
insert into "user_audit_action"("name") values ('login'), ('logout');
|
||||||
|
|
||||||
|
|
||||||
|
create table "user_audit" (
|
||||||
|
"id" serial not null,
|
||||||
|
"user_id" int not null,
|
||||||
|
"action_id" int not null,
|
||||||
|
"data" jsonb,
|
||||||
|
"when" timestamp DEFAULT(now()),
|
||||||
|
constraint "pk_user_history_id" primary key ("id"),
|
||||||
|
constraint "fk_user_history_user_uid" foreign key ("user_id") references "user"("uid") on delete cascade deferrable initially deferred,
|
||||||
|
constraint "fk_user_history_user_action" foreign key ("action_id") references "user_audit_action"("id") on delete cascade deferrable initially deferred
|
||||||
|
);
|
||||||
|
create index "ix_user_history_data" ON "user_audit" ((("data" ->> 'status')::text)) WHERE ("data" ->> 'status') IS not null;
|
||||||
|
comment on table "user_audit" IS 'saves user actions like login/logout';
|
||||||
|
comment on column "user_audit"."data" is 'data column contains information about taken action (if login was successful? if not, from what ip this action was taken?)';
|
||||||
|
|
||||||
|
|
||||||
|
create table "user_groups"(
|
||||||
|
"uid" integer not null,
|
||||||
|
"gid" integer not null
|
||||||
|
);
|
||||||
|
comment on table "user_groups" is '';
|
||||||
|
comment on column "user_groups"."uid" is '';
|
||||||
|
comment on column "user_groups"."gid" is '';
|
||||||
|
|
||||||
|
|
||||||
create or replace function update_category_parent_path() returns trigger as $$
|
create or replace function update_category_parent_path() returns trigger as $$
|
||||||
DECLARE
|
DECLARE
|
||||||
path ltree;
|
path ltree;
|
||||||
@ -260,7 +265,7 @@ create or replace function update_category_parent_path() returns trigger as $$
|
|||||||
IF NEW.parent_id IS NULL THEN
|
IF NEW.parent_id IS NULL THEN
|
||||||
NEW.parent_path = 'root'::ltree;
|
NEW.parent_path = 'root'::ltree;
|
||||||
ELSEIF TG_OP = 'INSERT' OR OLD.parent_id IS NULL OR OLD.parent_id != NEW.parent_id THEN
|
ELSEIF TG_OP = 'INSERT' OR OLD.parent_id IS NULL OR OLD.parent_id != NEW.parent_id THEN
|
||||||
SELECT parent_path || uid::text FROM "category" WHERE uid = NEW.parent_id INTO path;
|
SELECT parent_path || "id"::text FROM "category" WHERE "id" = NEW.parent_id INTO path;
|
||||||
IF path IS NULL THEN
|
IF path IS NULL THEN
|
||||||
RAISE exception 'Invalid parent_uid %', NEW.parent_id;
|
RAISE exception 'Invalid parent_uid %', NEW.parent_id;
|
||||||
END IF;
|
END IF;
|
||||||
@ -274,18 +279,18 @@ create table "category"(
|
|||||||
"parent_id" int,
|
"parent_id" int,
|
||||||
"description" text check(length(description) < 100000 ),
|
"description" text check(length(description) < 100000 ),
|
||||||
"parent_path" ltree,
|
"parent_path" ltree,
|
||||||
constraint "pk_category_uid" primary key ("uid"),
|
constraint "pk_category_uid" primary key ("id"),
|
||||||
constraint "fk_category_parent_id" foreign key ("parent_id") references "category"("uid") on delete cascade deferrable initially deferred,
|
constraint "fk_category_parent_id" foreign key ("parent_id") references "category"("id") on delete cascade deferrable initially deferred,
|
||||||
constraint "fk_category_stat_owner" foreign key ("owner") references "user"("uid") deferrable initially immediate
|
constraint "fk_category_stat_owner" foreign key ("owner") references "user"("uid") deferrable initially immediate
|
||||||
) INHERITS (stat);
|
) INHERITS (stat);
|
||||||
create index "ix_category_parent_path" on "category" using GIST ("parent_path");
|
create index "ix_category_parent_path" on "category" using GIST ("parent_path");
|
||||||
create unique index "ux_category_name" on "category" ( "parent_id", "name" );
|
create unique index "ux_category_name" on "category" ( "parent_id", "name" );
|
||||||
create trigger "update_category_last_update" before update on "category" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
create trigger "update_category_last_update" before update on "category" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
||||||
create trigger "update_category_parent_path" before insert or update on "category" FOR EACH ROW EXECUTE PROCEDURE update_category_parent_path();
|
create trigger "update_category_parent_path" before insert or update on "category" FOR EACH ROW EXECUTE PROCEDURE update_category_parent_path();
|
||||||
comment on table "category" is 'categories of items';
|
comment on table "category" is 'categories of items';
|
||||||
comment on column "category"."parent_id" is '';
|
comment on column "category"."parent_id" is '';
|
||||||
comment on column "category"."description" is '';
|
comment on column "category"."description" is '';
|
||||||
comment on column "category"."parent_path" is '';
|
comment on column "category"."parent_path" is '';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -305,7 +310,7 @@ create table "metric_systems"(
|
|||||||
comment on table measurands IS 'Information about measured quantity length, time etc.';
|
comment on table measurands IS 'Information about measured quantity length, time etc.';
|
||||||
|
|
||||||
create table units(
|
create table units(
|
||||||
symbol VARCHAR (20) NOT NULL,
|
symbol VARCHAR (20) not null,
|
||||||
description TEXT check(length(description) < 100000),
|
description TEXT check(length(description) < 100000),
|
||||||
measurand_id int REFERENCES measurands(id),
|
measurand_id int REFERENCES measurands(id),
|
||||||
base_unit int REFERENCES units(uid),
|
base_unit int REFERENCES units(uid),
|
||||||
@ -321,9 +326,9 @@ comment on column units.symbol IS 'Parameter symbol e.g. A';
|
|||||||
comment on column units.description IS 'Simple description';
|
comment on column units.description IS 'Simple description';
|
||||||
|
|
||||||
create table units_conversions(
|
create table units_conversions(
|
||||||
from_unit INTEGER NOT NULL REFERENCES units(uid),
|
from_unit INTEGER not null REFERENCES units(uid),
|
||||||
to_unit INTEGER NOT NULL REFERENCES units(uid),
|
to_unit INTEGER not null REFERENCES units(uid),
|
||||||
equation TEXT NOT NULL,
|
equation TEXT not null,
|
||||||
constraint unit_conversions_unique primary key (from_unit, to_unit)
|
constraint unit_conversions_unique primary key (from_unit, to_unit)
|
||||||
);
|
);
|
||||||
comment on table units_conversions IS 'This table contains a mathematical equation for converting one unitl to other, more info available at http://www.partow.net/programming/exprtk/index.html';
|
comment on table units_conversions IS 'This table contains a mathematical equation for converting one unitl to other, more info available at http://www.partow.net/programming/exprtk/index.html';
|
||||||
@ -353,28 +358,33 @@ comment on column parameters.ptype IS '''stored'' parameter is a parameter whic
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
create table "item"(
|
create table "item"(
|
||||||
"category_id" int NOT NULL,
|
"category_id" int not null,
|
||||||
"symbol" text NOT NULL,
|
"symbol" text not null,
|
||||||
"original_symbol" text,
|
"original_symbol" text,
|
||||||
"producer" text,
|
"producer" text,
|
||||||
"visibility" VARCHAR(64) DEFAULT 'global' NOT NULL,
|
"visibility" VARCHAR(64) DEFAULT 'global' not null,
|
||||||
"attributes" jsonb NOT NULL DEFAULT('{}'),
|
"attributes" jsonb not null DEFAULT('{}'),
|
||||||
"description" TEXT,
|
"description" TEXT,
|
||||||
constraint "pk_items" primary key ("uid"),
|
constraint "pk_items" primary key ("id"),
|
||||||
constraint "fk_item_category" foreign key ("category_id") references "category"("uid") on delete cascade deferrable initially deferred,
|
constraint "fk_item_category" foreign key ("category_id") references "category"("id") on delete cascade deferrable initially deferred,
|
||||||
constraint "fk_item_user" foreign key ("owner") REFERENCES "user"("uid") deferrable initially IMMEDIATE
|
constraint "fk_item_user" foreign key ("owner") REFERENCES "user"("uid") deferrable initially IMMEDIATE
|
||||||
) INHERITS (stat);
|
) INHERITS (stat);
|
||||||
create index "ix_item_attributes" on "item" USING GIN ("attributes");
|
create index "ix_item_attributes" on "item" USING GIN ("attributes");
|
||||||
create unique index "ux_item" on "item"("name", "symbol");
|
create unique index "ux_item" on "item"("name", "symbol");
|
||||||
create trigger update_item_last_update before update on item FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
create trigger update_item_last_update before update on item FOR EACH ROW EXECUTE PROCEDURE last_update_column();
|
||||||
comment on table "item" is '';
|
comment on table "item" is '';
|
||||||
comment on column "item"."category_id" is '';
|
comment on column "item"."category_id" is '';
|
||||||
comment on column "item"."visibility" is '';
|
comment on column "item"."symbol" is '';
|
||||||
|
comment on column "item"."original_symbol" is '';
|
||||||
|
comment on column "item"."producer" is '';
|
||||||
|
comment on column "item"."visibility" is '';
|
||||||
|
comment on column "item"."attributes" is '';
|
||||||
|
comment on column "item"."description" is '';
|
||||||
|
|
||||||
|
|
||||||
create table "inventory"(
|
create table "inventory"(
|
||||||
"description" TEXT check(length(description)< 100000),
|
"description" TEXT check(length(description)< 100000),
|
||||||
constraint "pk_inventory" primary key ("uid"),
|
constraint "pk_inventory" primary key ("id"),
|
||||||
constraint "fk_inventory_owner" foreign key ("owner") REFERENCES "user" ("uid") deferrable initially IMMEDIATE,
|
constraint "fk_inventory_owner" foreign key ("owner") REFERENCES "user" ("uid") deferrable initially IMMEDIATE,
|
||||||
constraint "chk_inventory_name_length" check (length(name) < 100)
|
constraint "chk_inventory_name_length" check (length(name) < 100)
|
||||||
) INHERITS (stat);
|
) INHERITS (stat);
|
||||||
@ -382,16 +392,16 @@ create trigger update_inventory_last_update before update on inventory FOR EACH
|
|||||||
|
|
||||||
|
|
||||||
create table "user_inventory"(
|
create table "user_inventory"(
|
||||||
"user_id" INTEGER NOT NULL REFERENCES "user" on DELETE CASCADE,
|
"user_id" INTEGER not null REFERENCES "user" on DELETE CASCADE,
|
||||||
"inventory_id" INTEGER NOT NULL REFERENCES "inventory" on DELETE CASCADE,
|
"inventory_id" INTEGER not null REFERENCES "inventory" on DELETE CASCADE,
|
||||||
constraint user_inventory_pk primary key ("inventory_id", "user_id")
|
constraint user_inventory_pk primary key ("inventory_id", "user_id")
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
create table in_stock(
|
create table in_stock(
|
||||||
item_id INTEGER NOT NULL REFERENCES items,
|
item_id INTEGER not null REFERENCES items,
|
||||||
inventory_id INTEGER NOT NULL REFERENCES inventory,
|
inventory_id INTEGER not null REFERENCES inventory,
|
||||||
amount numeric(10,10) NOT NULL DEFAULT 0
|
amount numeric(10,10) not null DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
comment on table in_stock IS 'Table contains information about items being available in storage';
|
comment on table in_stock IS 'Table contains information about items being available in storage';
|
||||||
@ -403,9 +413,9 @@ create table inventory_operations(
|
|||||||
) INHERITS(stat);
|
) INHERITS(stat);
|
||||||
|
|
||||||
create table inventory_history(
|
create table inventory_history(
|
||||||
inventory_from_id INTEGER NOT NULL REFERENCES inventory on DELETE CASCADE,
|
inventory_from_id INTEGER not null REFERENCES inventory on DELETE CASCADE,
|
||||||
inventory_to_id INTEGER NOT NULL REFERENCES inventory on DELETE CASCADE,
|
inventory_to_id INTEGER not null REFERENCES inventory on DELETE CASCADE,
|
||||||
operation_id INTEGER NOT NULL REFERENCES inventory_Operations on DELETE CASCADE ,
|
operation_id INTEGER not null REFERENCES inventory_Operations on DELETE CASCADE ,
|
||||||
amount NUMERIC(10,10),
|
amount NUMERIC(10,10),
|
||||||
|
|
||||||
date timestamp not null default now()
|
date timestamp not null default now()
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
INCLUDE_DIRECTORIES(.)
|
INCLUDE_DIRECTORIES(.)
|
||||||
|
|
||||||
|
add_subdirectory(utils)
|
||||||
|
|
||||||
add_subdirectory(eedb)
|
add_subdirectory(eedb)
|
||||||
add_subdirectory(app)
|
add_subdirectory(app)
|
||||||
|
|||||||
@ -1,42 +1,22 @@
|
|||||||
#include <eedb/auth/PgUserAuth.hpp>
|
#include <eedb/auth/PgUserAuth.hpp>
|
||||||
#include <eedb/auth/Services.hpp>
|
#include <eedb/auth/Services.hpp>
|
||||||
#include <eedb/db/connection.hpp>
|
#include <eedb/db/connection.hpp>
|
||||||
|
#include <eedb/widgets/AuthWidget.hpp>
|
||||||
|
#include <eedb/widgets/Theme.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <Wt/WApplication>
|
#include <Wt/WApplication>
|
||||||
#include <Wt/WBootstrapTheme>
|
|
||||||
#include <Wt/WBorderLayout>
|
#include <Wt/WBorderLayout>
|
||||||
#include <Wt/WBreak>
|
|
||||||
#include <Wt/WContainerWidget>
|
#include <Wt/WContainerWidget>
|
||||||
#include <Wt/WHBoxLayout>
|
|
||||||
#include <Wt/WLineEdit>
|
#include <Wt/WLineEdit>
|
||||||
#include <Wt/WMenu>
|
|
||||||
#include <Wt/WMessageBox>
|
#include <Wt/WMessageBox>
|
||||||
#include <Wt/WNavigationBar>
|
#include <Wt/WNavigationBar>
|
||||||
#include <Wt/WPopupMenu>
|
#include <Wt/WPopupMenu>
|
||||||
#include <Wt/WPopupWidget>
|
|
||||||
#include <Wt/WPushButton>
|
|
||||||
#include <Wt/WServer>
|
#include <Wt/WServer>
|
||||||
#include <Wt/WStackedWidget>
|
#include <Wt/WStackedWidget>
|
||||||
#include <Wt/WTabWidget>
|
|
||||||
#include <Wt/WText>
|
#include <Wt/WText>
|
||||||
#include <Wt/WTextArea>
|
#include <Wt/WTextArea>
|
||||||
#include <Wt/WTextEdit>
|
|
||||||
#include <Wt/WVBoxLayout>
|
|
||||||
#include <Wt/WWidget>
|
|
||||||
|
|
||||||
#include <Wt/Auth/PasswordService>
|
|
||||||
#include <Wt/Auth/PasswordStrengthValidator>
|
|
||||||
#include <Wt/Auth/PasswordVerifier>
|
|
||||||
|
|
||||||
#include <Wt/Auth/AuthWidget>
|
|
||||||
#include <Wt/Auth/Dbo/AuthInfo>
|
|
||||||
#include <Wt/Auth/Dbo/UserDatabase>
|
|
||||||
#include <Wt/Auth/FacebookService>
|
|
||||||
#include <Wt/Auth/GoogleService>
|
|
||||||
#include <Wt/Auth/HashFunction>
|
|
||||||
#include <Wt/Auth/Login>
|
|
||||||
|
|
||||||
class AuthApplication : public Wt::WApplication {
|
class AuthApplication : public Wt::WApplication {
|
||||||
public:
|
public:
|
||||||
@ -44,7 +24,7 @@ class AuthApplication : public Wt::WApplication {
|
|||||||
login_.changed().connect(this, &AuthApplication::authEvent);
|
login_.changed().connect(this, &AuthApplication::authEvent);
|
||||||
|
|
||||||
auto config = std::make_shared< sqlpp::postgresql::connection_config >();
|
auto config = std::make_shared< sqlpp::postgresql::connection_config >();
|
||||||
config->host = "192.168.1.101";
|
config->host = "10.154.46.106";
|
||||||
config->port = 5432;
|
config->port = 5432;
|
||||||
config->user = "postgres";
|
config->user = "postgres";
|
||||||
config->password = "postgres";
|
config->password = "postgres";
|
||||||
@ -53,30 +33,16 @@ class AuthApplication : public Wt::WApplication {
|
|||||||
|
|
||||||
conn_ = std::make_unique< eedb::db::PgConnection >(config);
|
conn_ = std::make_unique< eedb::db::PgConnection >(config);
|
||||||
userDatabase_ = std::make_unique< eedb::auth::PgUserAuth >(*conn_, env);
|
userDatabase_ = std::make_unique< eedb::auth::PgUserAuth >(*conn_, env);
|
||||||
userDatabase_->setAuthService(eedb::auth::Services::authService());
|
|
||||||
|
|
||||||
root()->addStyleClass("container");
|
root()->addStyleClass("container");
|
||||||
|
|
||||||
auto theme = new Wt::WBootstrapTheme(this);
|
|
||||||
theme->setVersion(Wt::WBootstrapTheme::Version3);
|
|
||||||
theme->setResponsive(true);
|
|
||||||
setTheme(theme);
|
|
||||||
|
|
||||||
useStyleSheet("/resources/style.css");
|
useStyleSheet("/resources/style.css");
|
||||||
|
|
||||||
_loginWidget = new Wt::Auth::AuthWidget(*eedb::auth::Services::authService(), *userDatabase_, login_);
|
setTheme(eedb::BootstrapTheme(this).create());
|
||||||
|
|
||||||
_loginWidget->model()->addPasswordAuth(eedb::auth::Services::passwordService());
|
_authWidget = new eedb::AuthWidget(eedb::auth::Services{}, *userDatabase_, login_);
|
||||||
_loginWidget->model()->addOAuth(eedb::auth::Services::oAuthServices());
|
root()->addWidget(_authWidget);
|
||||||
_loginWidget->setRegistrationEnabled(true);
|
|
||||||
|
|
||||||
_loginWidget->processEnvironment();
|
|
||||||
|
|
||||||
root()->addWidget(_loginWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dddd() {}
|
|
||||||
|
|
||||||
void authEvent() {
|
void authEvent() {
|
||||||
using namespace Wt;
|
using namespace Wt;
|
||||||
|
|
||||||
@ -131,7 +97,7 @@ class AuthApplication : public Wt::WApplication {
|
|||||||
help->setMenu(popup);
|
help->setMenu(popup);
|
||||||
|
|
||||||
rightMenu->addItem(help);
|
rightMenu->addItem(help);
|
||||||
sessionMenu->addItem("session", _loginWidget);
|
// sessionMenu->addItem("session", _authWidget);
|
||||||
|
|
||||||
// Add a Search control.
|
// Add a Search control.
|
||||||
Wt::WLineEdit * edit = new Wt::WLineEdit();
|
Wt::WLineEdit * edit = new Wt::WLineEdit();
|
||||||
@ -160,7 +126,7 @@ class AuthApplication : public Wt::WApplication {
|
|||||||
|
|
||||||
layout->addWidget(navigation, Wt::WBorderLayout::North);
|
layout->addWidget(navigation, Wt::WBorderLayout::North);
|
||||||
|
|
||||||
Wt::WText * item = new Wt::WText(Wt::WString(cell).arg("North"));
|
Wt::WText * item = new Wt::WText(Wt::WString(cell).arg("North"));
|
||||||
item->setStyleClass("green-box");
|
item->setStyleClass("green-box");
|
||||||
layout->addWidget(menu, Wt::WBorderLayout::West);
|
layout->addWidget(menu, Wt::WBorderLayout::West);
|
||||||
|
|
||||||
@ -176,12 +142,13 @@ class AuthApplication : public Wt::WApplication {
|
|||||||
item->setStyleClass("green-box");
|
item->setStyleClass("green-box");
|
||||||
layout->addWidget(contents, Wt::WBorderLayout::Center);
|
layout->addWidget(contents, Wt::WBorderLayout::Center);
|
||||||
} else {
|
} else {
|
||||||
Wt::Auth::AuthWidget * authWidget = new Wt::Auth::AuthWidget(*eedb::auth::Services::authService(), *userDatabase_, login_);
|
// Wt::Auth::AuthWidget * authWidget = new Wt::Auth::AuthWidget(*eedb::auth::Services::authService(), *userDatabase_,
|
||||||
root()->clear();
|
// login_);
|
||||||
authWidget->model()->addPasswordAuth(eedb::auth::Services::passwordService());
|
// root()->clear();
|
||||||
authWidget->model()->addOAuth(eedb::auth::Services::oAuthServices());
|
// authWidget->model()->addPasswordAuth(eedb::auth::Services::passwordService());
|
||||||
authWidget->setRegistrationEnabled(true);
|
// authWidget->model()->addOAuth(eedb::auth::Services::oAuthServices());
|
||||||
root()->addWidget(authWidget);
|
// authWidget->setRegistrationEnabled(true);
|
||||||
|
// root()->addWidget(authWidget);
|
||||||
|
|
||||||
Wt::log("notice") << "User logged out.";
|
Wt::log("notice") << "User logged out.";
|
||||||
}
|
}
|
||||||
@ -191,7 +158,7 @@ class AuthApplication : public Wt::WApplication {
|
|||||||
std::unique_ptr< eedb::db::PgConnection > conn_;
|
std::unique_ptr< eedb::db::PgConnection > conn_;
|
||||||
std::unique_ptr< eedb::auth::PgUserAuth > userDatabase_;
|
std::unique_ptr< eedb::auth::PgUserAuth > userDatabase_;
|
||||||
Wt::Auth::Login login_;
|
Wt::Auth::Login login_;
|
||||||
Wt::Auth::AuthWidget * _loginWidget;
|
eedb::AuthWidget * _authWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
Wt::WApplication * createApplication(const Wt::WEnvironment & env) {
|
Wt::WApplication * createApplication(const Wt::WEnvironment & env) {
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <eedb/db/connection.hpp>
|
#include <eedb/db/connection.hpp>
|
||||||
|
|
||||||
|
#include <eedb/auth/Services.hpp>
|
||||||
|
|
||||||
#include <sqlpp11/sqlpp11.h>
|
#include <sqlpp11/sqlpp11.h>
|
||||||
|
|
||||||
#include <eedb/model/auth_identity.h>
|
#include <eedb/model/auth_identity.h>
|
||||||
@ -9,7 +11,7 @@
|
|||||||
#include <eedb/model/auth_token.h>
|
#include <eedb/model/auth_token.h>
|
||||||
#include <eedb/model/user.h>
|
#include <eedb/model/user.h>
|
||||||
#include <eedb/model/user_action.h>
|
#include <eedb/model/user_action.h>
|
||||||
#include <eedb/model/user_history.h>
|
#include <eedb/model/user_audit.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
@ -30,37 +32,36 @@ using namespace sqlpp;
|
|||||||
using namespace Wt::Auth;
|
using namespace Wt::Auth;
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
|
|
||||||
|
std::string RandomString(int len) {
|
||||||
|
using namespace std;
|
||||||
|
srand(time(0));
|
||||||
|
string str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
string newstr;
|
||||||
|
int pos;
|
||||||
|
while(newstr.size() != len) {
|
||||||
|
pos = ((rand() % (str.size() - 1)));
|
||||||
|
newstr += str.substr(pos, 1);
|
||||||
|
}
|
||||||
|
return newstr;
|
||||||
|
}
|
||||||
|
|
||||||
template < typename Connection >
|
template < typename Connection >
|
||||||
struct TransactionGuard {
|
struct TransactionGuard : public Wt::Auth::AbstractUserDatabase::Transaction {
|
||||||
TransactionGuard(Connection & c) : _c(c) {
|
TransactionGuard(Connection & c) : _c(c) {
|
||||||
_c.native()->start_transaction();
|
_c.native()->start_transaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
~TransactionGuard() {
|
void commit() override {
|
||||||
_c.native()->commit_transaction();
|
_c.native()->commit_transaction();
|
||||||
}
|
}
|
||||||
|
void rollback() override {
|
||||||
|
_c.native()->rollback_transaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
Connection & _c;
|
Connection & _c;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string RandomString(int stringLength = 20) {
|
|
||||||
std::default_random_engine prne(std::chrono::steady_clock::now().time_since_epoch().count());
|
|
||||||
std::uniform_int_distribution< char > uid('A', 'z');
|
|
||||||
auto randomCharacter = std::bind(uid, prne);
|
|
||||||
std::string s(stringLength, ' ');
|
|
||||||
|
|
||||||
std::generate(s.begin(), s.end(), [&randomCharacter]() -> char {
|
|
||||||
while(true) {
|
|
||||||
const char c = randomCharacter();
|
|
||||||
|
|
||||||
if(std::isalpha(c))
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace eedb::auth {
|
namespace eedb::auth {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -68,7 +69,7 @@ namespace {
|
|||||||
SQLPP_ALIAS_PROVIDER(user_status);
|
SQLPP_ALIAS_PROVIDER(user_status);
|
||||||
|
|
||||||
constexpr eedb::user t_user;
|
constexpr eedb::user t_user;
|
||||||
constexpr eedb::user_history t_user_history;
|
constexpr eedb::user_audit t_user_history;
|
||||||
constexpr eedb::user_action t_user_action;
|
constexpr eedb::user_action t_user_action;
|
||||||
constexpr eedb::auth_identity authIdentity;
|
constexpr eedb::auth_identity authIdentity;
|
||||||
constexpr eedb::auth_info authInfo;
|
constexpr eedb::auth_info authInfo;
|
||||||
@ -79,11 +80,18 @@ namespace {
|
|||||||
auto auth_info_identity = authInfo.join(authIdentity).on(authInfo.id == authIdentity.auth_info_id);
|
auto auth_info_identity = authInfo.join(authIdentity).on(authInfo.id == authIdentity.auth_info_id);
|
||||||
auto user_auth_info = t_user.join(authInfo).on(authInfo.user_uid == t_user.uid);
|
auto user_auth_info = t_user.join(authInfo).on(authInfo.user_uid == t_user.uid);
|
||||||
auto auth_token_info = user_auth_info.join(t_auth_token).on(t_auth_token.auth_info_id == authInfo.id);
|
auto auth_token_info = user_auth_info.join(t_auth_token).on(t_auth_token.auth_info_id == authInfo.id);
|
||||||
|
|
||||||
|
const auto select_login_action_id = select(t_user_action.id) //
|
||||||
|
.from(t_user_action) //
|
||||||
|
.where(t_user_action.name == "login") //
|
||||||
|
.limit(1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
PgUserAuth::~PgUserAuth() {}
|
PgUserAuth::~PgUserAuth() {}
|
||||||
|
|
||||||
PgUserAuth::PgUserAuth(eedb::db::PgConnection & _db, const Wt::WEnvironment & env) : db(_db), _env(env) {}
|
PgUserAuth::PgUserAuth(eedb::db::PgConnection & _db, const Wt::WEnvironment & env) : db(_db), _env(env) {
|
||||||
|
this->setAuthService(eedb::auth::Services::authService());
|
||||||
|
}
|
||||||
|
|
||||||
User PgUserAuth::findWithId(const std::string & id) const {
|
User PgUserAuth::findWithId(const std::string & id) const {
|
||||||
const auto uid_eq = t_user.uid == std::atoi(id.c_str());
|
const auto uid_eq = t_user.uid == std::atoi(id.c_str());
|
||||||
@ -151,20 +159,13 @@ void PgUserAuth::setIdentity(const User & user, const std::string & provider, co
|
|||||||
const auto uid = std::atoi(user.id().c_str());
|
const auto uid = std::atoi(user.id().c_str());
|
||||||
const auto provider_eq = authIdentity.provider == provider;
|
const auto provider_eq = authIdentity.provider == provider;
|
||||||
|
|
||||||
TransactionGuard< decltype(db) > guard{db};
|
|
||||||
auto ret = db(select(authInfo.id) //
|
|
||||||
.from(authInfo) //
|
|
||||||
.where(authInfo.user_uid == uid));
|
|
||||||
|
|
||||||
if(ret.empty()) {
|
|
||||||
throw std::exception();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto auth_info_id = ret.front().id;
|
|
||||||
|
|
||||||
db(update(authIdentity) //
|
db(update(authIdentity) //
|
||||||
.set(authIdentity.identity = identity.toUTF8()) //
|
.set(authIdentity.identity = identity.toUTF8()) //
|
||||||
.where(authIdentity.auth_info_id == auth_info_id and provider_eq));
|
.where(authIdentity.auth_info_id ==
|
||||||
|
select(authInfo.id) //
|
||||||
|
.from(authInfo) //
|
||||||
|
.where(authInfo.user_uid == uid) and
|
||||||
|
provider_eq));
|
||||||
}
|
}
|
||||||
|
|
||||||
Wt::WString PgUserAuth::identity(const User & user, const std::string & provider) const {
|
Wt::WString PgUserAuth::identity(const User & user, const std::string & provider) const {
|
||||||
@ -190,32 +191,24 @@ void PgUserAuth::removeIdentity(const User & user, const std::string & provider)
|
|||||||
}
|
}
|
||||||
|
|
||||||
User PgUserAuth::registerNew() {
|
User PgUserAuth::registerNew() {
|
||||||
TransactionGuard< decltype(db) > guard{db};
|
auto user_id = db(sqlpp::postgresql::insert_into(t_user) //
|
||||||
|
.set( //
|
||||||
auto user_id = db(sqlpp::postgresql::insert_into(t_user) //
|
t_user.full_name = RandomString(256), //
|
||||||
.set(t_user.email = RandomString(20) + "@random.org", //
|
t_user.status = -1)
|
||||||
t_user.name = RandomString(256), //
|
|
||||||
t_user.status = -1)
|
|
||||||
.returning(t_user.uid))
|
.returning(t_user.uid))
|
||||||
.front()
|
.front()
|
||||||
.uid;
|
.uid;
|
||||||
|
|
||||||
auto info_id = db(sqlpp::postgresql::insert_into(authInfo)
|
db(sqlpp::postgresql::insert_into(authInfo)
|
||||||
.set(authInfo.password_hash = "", //
|
.set( //
|
||||||
authInfo.password_method = "", //
|
authInfo.password_hash = "NONE", //
|
||||||
authInfo.password_salt = "", //
|
authInfo.password_method = "NONE", //
|
||||||
authInfo.user_uid = user_id, //
|
authInfo.password_salt = "NONE", //
|
||||||
authInfo.unverified_email = "", //
|
authInfo.user_uid = user_id, //
|
||||||
authInfo.email_token = "", //
|
authInfo.email = RandomString(20) + "@random.org") //
|
||||||
authInfo.email_token_role = 0) //
|
.returning(authInfo.id))
|
||||||
.returning(authInfo.id))
|
.front()
|
||||||
.front()
|
.id;
|
||||||
.id;
|
|
||||||
|
|
||||||
db(insert_into(authIdentity) //
|
|
||||||
.set(authIdentity.identity = RandomString(256), //
|
|
||||||
authIdentity.provider = "", //
|
|
||||||
authIdentity.auth_info_id = info_id));
|
|
||||||
|
|
||||||
return User{std::to_string(user_id), *this};
|
return User{std::to_string(user_id), *this};
|
||||||
}
|
}
|
||||||
@ -244,9 +237,10 @@ void PgUserAuth::deleteUser(const User & user) {
|
|||||||
|
|
||||||
void PgUserAuth::setPassword(const User & user, const PasswordHash & password) {
|
void PgUserAuth::setPassword(const User & user, const PasswordHash & password) {
|
||||||
db(update(authInfo)
|
db(update(authInfo)
|
||||||
.set(authInfo.password_hash = password.value(), //
|
.set( //
|
||||||
authInfo.password_method = password.function(), //
|
authInfo.password_hash = password.value(), //
|
||||||
authInfo.password_salt = password.salt())
|
authInfo.password_method = password.function(), //
|
||||||
|
authInfo.password_salt = password.salt())
|
||||||
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,52 +257,65 @@ PasswordHash PgUserAuth::password(const User & user) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PgUserAuth::setEmail(const User & user, const std::string & address) {
|
bool PgUserAuth::setEmail(const User & user, const std::string & address) {
|
||||||
const auto uid_eq = t_user.uid == std::atoi(user.id().c_str());
|
const auto uid_eq = authInfo.user_uid == std::atoi(user.id().c_str());
|
||||||
|
|
||||||
db(update(t_user) //
|
db(update(authInfo) //
|
||||||
.set(t_user.email = address) //
|
.set( //
|
||||||
|
authInfo.email = address,
|
||||||
|
authInfo.email_verified = true) //
|
||||||
.where(uid_eq));
|
.where(uid_eq));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PgUserAuth::email(const User & user) const {
|
std::string PgUserAuth::email(const User & user) const {
|
||||||
auto ret = db(select(t_user.email) //
|
auto ret = db(select(authInfo.email) //
|
||||||
.from(t_user) //
|
.from(authInfo) //
|
||||||
.where(t_user.uid == std::atoi(user.id().c_str())));
|
.where(authInfo.user_uid == std::atoi(user.id().c_str()) and authInfo.email_verified == true));
|
||||||
if(ret.empty())
|
if(ret.empty())
|
||||||
return {};
|
return {};
|
||||||
return std::move(ret.front().email);
|
return std::move(ret.front().email);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PgUserAuth::setUnverifiedEmail(const User & user, const std::string & address) {
|
void PgUserAuth::setUnverifiedEmail(const User & user, const std::string & address) {
|
||||||
db(update(authInfo) //
|
// orginal implementation of UserDatabase (provided by WT team) sets veryfied and unverified emails in
|
||||||
.set(authInfo.unverified_email = address) //
|
// different fields in database. So in order to verify email, they just copy the unverified_email to email and then
|
||||||
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
// set unverified_email to empty string (db don't allow empty strings as email*)
|
||||||
|
if(address.empty())
|
||||||
|
db(update(authInfo) //
|
||||||
|
.set(authInfo.email_verified = true) //
|
||||||
|
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
||||||
|
else
|
||||||
|
db(update(authInfo) //
|
||||||
|
.set( //
|
||||||
|
authInfo.email = address, //
|
||||||
|
authInfo.email_verified = false) //
|
||||||
|
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PgUserAuth::unverifiedEmail(const User & user) const {
|
std::string PgUserAuth::unverifiedEmail(const User & user) const {
|
||||||
auto ret = db(select(authInfo.unverified_email) //
|
auto ret = db(select(authInfo.email) //
|
||||||
.from(authInfo) //
|
.from(authInfo) //
|
||||||
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
.where(authInfo.user_uid == std::atoi(user.id().c_str()) and authInfo.email_verified == false));
|
||||||
if(ret.empty())
|
if(ret.empty())
|
||||||
return {};
|
return {};
|
||||||
return std::move(ret.front().unverified_email);
|
return std::move(ret.front().email);
|
||||||
}
|
}
|
||||||
|
|
||||||
User PgUserAuth::findWithEmail(const std::string & address) const {
|
User PgUserAuth::findWithEmail(const std::string & address) const {
|
||||||
auto ret = db(select(t_user.uid) //
|
auto ret = db(select(authInfo.user_uid) //
|
||||||
.from(t_user) //
|
.from(authInfo) //
|
||||||
.where(t_user.email == address));
|
.where(authInfo.email == address and authInfo.email_verified == true));
|
||||||
|
|
||||||
if(ret.empty())
|
if(ret.empty())
|
||||||
return {};
|
return {};
|
||||||
return {std::to_string(ret.front().uid), *this};
|
return {std::to_string(ret.front().user_uid), *this};
|
||||||
}
|
}
|
||||||
|
|
||||||
void PgUserAuth::setEmailToken(const User & user, const Token & token, User::EmailTokenRole role) {
|
void PgUserAuth::setEmailToken(const User & user, const Token & token, User::EmailTokenRole role) {
|
||||||
auto exp = ::date::floor<::std::chrono::milliseconds >(std::chrono::system_clock::from_time_t(token.expirationTime().toTime_t()));
|
auto exp = ::date::floor<::std::chrono::milliseconds >(std::chrono::system_clock::from_time_t(token.expirationTime().toTime_t()));
|
||||||
db(update(authInfo) //
|
db(update(authInfo) //
|
||||||
.set(authInfo.email_token = token.hash(), //
|
.set( //
|
||||||
|
authInfo.email_token = token.hash(), //
|
||||||
authInfo.email_token_expires = exp,
|
authInfo.email_token_expires = exp,
|
||||||
authInfo.email_token_role = static_cast< int >(role)) //
|
authInfo.email_token_role = static_cast< int >(role)) //
|
||||||
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
||||||
@ -348,13 +355,13 @@ User PgUserAuth::findWithEmailToken(const std::string & hash) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PgUserAuth::addAuthToken(const User & user, const Token & token) {
|
void PgUserAuth::addAuthToken(const User & user, const Token & token) {
|
||||||
TransactionGuard< decltype(db) > guard{db};
|
auto select_identity_id = select(authInfo.id) //
|
||||||
auto identity_id = db(select(authInfo.id) //
|
.from(authInfo)
|
||||||
.from(authInfo) //
|
.where(authInfo.user_uid == std::atoi(user.id().c_str()))
|
||||||
.where(authInfo.user_uid == std::atoi(user.id().c_str())));
|
.limit(1u);
|
||||||
db(insert_into(t_auth_token) //
|
db(insert_into(t_auth_token) //
|
||||||
.set( //
|
.set( //
|
||||||
t_auth_token.auth_info_id = identity_id.front().id, //
|
t_auth_token.auth_info_id = select_identity_id, //
|
||||||
t_auth_token.expires = std::chrono::system_clock::now() + ::sqlpp::chrono::days{14}, //
|
t_auth_token.expires = std::chrono::system_clock::now() + ::sqlpp::chrono::days{14}, //
|
||||||
t_auth_token.value = token.hash()));
|
t_auth_token.value = token.hash()));
|
||||||
}
|
}
|
||||||
@ -379,7 +386,6 @@ User PgUserAuth::findWithAuthToken(const std::string & hash) const {
|
|||||||
|
|
||||||
int PgUserAuth::updateAuthToken(const User & user, const std::string & oldhash, const std::string & newhash) {
|
int PgUserAuth::updateAuthToken(const User & user, const std::string & oldhash, const std::string & newhash) {
|
||||||
// method called only after successful login
|
// method called only after successful login
|
||||||
TransactionGuard< decltype(db) > guard{db};
|
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
auto identity_id = db(select(authInfo.id) //
|
auto identity_id = db(select(authInfo.id) //
|
||||||
.from(authInfo) //
|
.from(authInfo) //
|
||||||
@ -405,17 +411,9 @@ int PgUserAuth::updateAuthToken(const User & user, const std::string & oldhash,
|
|||||||
{"url_scheme", _env.urlScheme()} //
|
{"url_scheme", _env.urlScheme()} //
|
||||||
};
|
};
|
||||||
|
|
||||||
auto action_id = db(select(t_user_action.id) //
|
|
||||||
.from(t_user_action) //
|
|
||||||
.where(t_user_action.name == "login"));
|
|
||||||
if(action_id.empty())
|
|
||||||
action_id = db(postgresql::insert_into(t_user_action) //
|
|
||||||
.set(t_user_action.name = "login") //
|
|
||||||
.returning(t_user_action.id));
|
|
||||||
|
|
||||||
db(insert_into(t_user_history)
|
db(insert_into(t_user_history)
|
||||||
.set(t_user_history.user_id = std::atoi(user.id().c_str()),
|
.set(t_user_history.user_id = std::atoi(user.id().c_str()),
|
||||||
t_user_history.action_id = action_id.front().id, //
|
t_user_history.action_id = select_login_action_id, //
|
||||||
t_user_history.data = tao::json::to_string(data)));
|
t_user_history.data = tao::json::to_string(data)));
|
||||||
|
|
||||||
auto now = sqlpp::time_point::_cpp_value_type::clock::now();
|
auto now = sqlpp::time_point::_cpp_value_type::clock::now();
|
||||||
@ -425,8 +423,6 @@ int PgUserAuth::updateAuthToken(const User & user, const std::string & oldhash,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PgUserAuth::setFailedLoginAttempts(const User & user, int count) {
|
void PgUserAuth::setFailedLoginAttempts(const User & user, int count) {
|
||||||
TransactionGuard< decltype(db) > guard{db};
|
|
||||||
|
|
||||||
auto getStatus = [count]() { return count ? "failed"s : "success"s; };
|
auto getStatus = [count]() { return count ? "failed"s : "success"s; };
|
||||||
|
|
||||||
const tao::json::value data{
|
const tao::json::value data{
|
||||||
@ -439,43 +435,34 @@ void PgUserAuth::setFailedLoginAttempts(const User & user, int count) {
|
|||||||
{"url_scheme", _env.urlScheme()} //
|
{"url_scheme", _env.urlScheme()} //
|
||||||
};
|
};
|
||||||
|
|
||||||
auto action_id = db(select(t_user_action.id) //
|
|
||||||
.from(t_user_action) //
|
|
||||||
.where(t_user_action.name == "login"));
|
|
||||||
if(action_id.empty())
|
|
||||||
action_id = db(postgresql::insert_into(t_user_action) //
|
|
||||||
.set(t_user_action.name = "login") //
|
|
||||||
.returning(t_user_action.id));
|
|
||||||
|
|
||||||
db(insert_into(t_user_history)
|
db(insert_into(t_user_history)
|
||||||
.set(t_user_history.user_id = std::atoi(user.id().c_str()),
|
.set(t_user_history.user_id = std::atoi(user.id().c_str()),
|
||||||
t_user_history.action_id = action_id.front().id, //
|
t_user_history.action_id = select_login_action_id, //
|
||||||
t_user_history.data = tao::json::to_string(data)));
|
t_user_history.data = tao::json::to_string(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int PgUserAuth::failedLoginAttempts(const User & user) const {
|
int PgUserAuth::failedLoginAttempts(const User & user) const {
|
||||||
auto res =
|
auto res = db(select(count(t_user_history.id)) //
|
||||||
db(select(count(t_user_history.id)) //
|
.from(t_user_history) //
|
||||||
.from(t_user_history.inner_join(t_user_action).on(t_user_history.action_id == t_user_action.id)) //
|
.where(t_user_history.user_id == std::atoi(user.id().c_str()) and //
|
||||||
.where(t_user_history.user_id == std::atoi(user.id().c_str()) and //
|
t_user_history.action_id == select_login_action_id and //
|
||||||
t_user_action.name == "login" and //
|
sqlpp::verbatim< sqlpp::boolean >("user_history.data->>'status' = 'failed'") and //
|
||||||
sqlpp::verbatim< sqlpp::boolean >("user_history.data->>'status' = 'failed'") and //
|
t_user_history.id > select(t_user_history.id) //
|
||||||
t_user_history.id > select(t_user_history.id) //
|
.from(t_user_history) //
|
||||||
.from(t_user_history.inner_join(t_user_action).on(t_user_history.action_id == t_user_action.id)) //
|
.where(t_user_history.user_id == std::atoi(user.id().c_str()) and //
|
||||||
.where(t_user_history.user_id == std::atoi(user.id().c_str()) and //
|
t_user_history.action_id == select_login_action_id and //
|
||||||
t_user_action.name == "login" and //
|
sqlpp::verbatim< sqlpp::boolean >("user_history.data->>'status' = 'success'")) //
|
||||||
sqlpp::verbatim< sqlpp::boolean >("user_history.data->>'status' = 'success'")) //
|
.limit(1u)));
|
||||||
.limit(1u)));
|
|
||||||
return static_cast< int >(res.front().count);
|
return static_cast< int >(res.front().count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PgUserAuth::setLastLoginAttempt(const User &, const Wt::WDateTime &) {}
|
void PgUserAuth::setLastLoginAttempt(const User &, const Wt::WDateTime &) {}
|
||||||
|
|
||||||
Wt::WDateTime PgUserAuth::lastLoginAttempt(const User & user) const {
|
Wt::WDateTime PgUserAuth::lastLoginAttempt(const User & user) const {
|
||||||
auto res = db(select(t_user_history._when) //
|
auto res = db(select(t_user_history._when) //
|
||||||
.from(t_user_history.inner_join(t_user_action).on(t_user_history.action_id == t_user_action.id)) //
|
.from(t_user_history) //
|
||||||
.where(t_user_action.name == "login" and t_user_history.user_id == std::atoi(user.id().c_str())) //
|
.where(t_user_history.action_id == select_login_action_id and t_user_history.user_id == std::atoi(user.id().c_str())) //
|
||||||
.order_by(t_user_history.id.desc()) //
|
.order_by(t_user_history.id.desc()) //
|
||||||
.limit(1u));
|
.limit(1u));
|
||||||
if(res.empty())
|
if(res.empty())
|
||||||
return {};
|
return {};
|
||||||
@ -488,6 +475,6 @@ Wt::WDateTime PgUserAuth::lastLoginAttempt(const User & user) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AbstractUserDatabase::Transaction * PgUserAuth::startTransaction() {
|
AbstractUserDatabase::Transaction * PgUserAuth::startTransaction() {
|
||||||
return nullptr;
|
return new TransactionGuard< decltype(db) >(db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include <eedb/model/auth_info.h>
|
#include <eedb/model/auth_info.h>
|
||||||
#include <eedb/model/auth_token.h>
|
#include <eedb/model/auth_token.h>
|
||||||
#include <eedb/model/user.h>
|
#include <eedb/model/user.h>
|
||||||
#include <eedb/model/user_history.h>
|
#include <eedb/model/user_audit.h>
|
||||||
|
|
||||||
#include <Wt/WString>
|
#include <Wt/WString>
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Title {
|
struct Title {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="title";
|
static constexpr const char _literal[] = R"("title")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Apply_object {
|
struct Apply_object {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="apply_object";
|
static constexpr const char _literal[] = R"("apply_object")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -45,7 +45,7 @@ namespace eedb {
|
|||||||
action_::Apply_object> {
|
action_::Apply_object> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "action";
|
static constexpr const char _literal[] = R"("action")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Id {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="id";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Auth_info_id {
|
struct Auth_info_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="auth_info_id";
|
static constexpr const char _literal[] = R"("auth_info_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Provider {
|
struct Provider {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="provider";
|
static constexpr const char _literal[] = R"("provider")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Identity {
|
struct Identity {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="identity";
|
static constexpr const char _literal[] = R"("identity")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -77,7 +77,7 @@ namespace eedb {
|
|||||||
auth_identity_::Identity> {
|
auth_identity_::Identity> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "auth_identity";
|
static constexpr const char _literal[] = R"("auth_identity")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Id {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="id";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct User_uid {
|
struct User_uid {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="user_uid";
|
static constexpr const char _literal[] = R"("user_uid")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -36,12 +36,12 @@ namespace eedb {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::bigint, sqlpp::tag::can_be_null>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::can_be_null>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Password_hash {
|
struct Password_hash {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="password_hash";
|
static constexpr const char _literal[] = R"("password_hash")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Password_method {
|
struct Password_method {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="password_method";
|
static constexpr const char _literal[] = R"("password_method")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -71,7 +71,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Password_salt {
|
struct Password_salt {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="password_salt";
|
static constexpr const char _literal[] = R"("password_salt")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -84,24 +84,39 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::varchar, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::varchar, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Unverified_email {
|
struct Email {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="unverified_email";
|
static constexpr const char _literal[] = R"("email")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T unverified_email;
|
T email;
|
||||||
T &operator()() { return unverified_email; }
|
T &operator()() { return email; }
|
||||||
const T &operator()() const { return unverified_email; }
|
const T &operator()() const { return email; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::varchar, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::varchar, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Email_verified {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("email_verified")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T email_verified;
|
||||||
|
T &operator()() { return email_verified; }
|
||||||
|
const T &operator()() const { return email_verified; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::boolean>;
|
||||||
|
};
|
||||||
|
|
||||||
struct Email_token {
|
struct Email_token {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="email_token";
|
static constexpr const char _literal[] = R"("email_token")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -111,12 +126,12 @@ namespace eedb {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::varchar, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::varchar, sqlpp::tag::can_be_null>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Email_token_expires {
|
struct Email_token_expires {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="email_token_expires";
|
static constexpr const char _literal[] = R"("email_token_expires")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -131,7 +146,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Email_token_role {
|
struct Email_token_role {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="email_token_role";
|
static constexpr const char _literal[] = R"("email_token_role")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -141,7 +156,7 @@ namespace eedb {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::can_be_null>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,13 +166,14 @@ namespace eedb {
|
|||||||
auth_info_::Password_hash,
|
auth_info_::Password_hash,
|
||||||
auth_info_::Password_method,
|
auth_info_::Password_method,
|
||||||
auth_info_::Password_salt,
|
auth_info_::Password_salt,
|
||||||
auth_info_::Unverified_email,
|
auth_info_::Email,
|
||||||
|
auth_info_::Email_verified,
|
||||||
auth_info_::Email_token,
|
auth_info_::Email_token,
|
||||||
auth_info_::Email_token_expires,
|
auth_info_::Email_token_expires,
|
||||||
auth_info_::Email_token_role> {
|
auth_info_::Email_token_role> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "auth_info";
|
static constexpr const char _literal[] = R"("auth_info")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Id {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="id";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Auth_info_id {
|
struct Auth_info_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="auth_info_id";
|
static constexpr const char _literal[] = R"("auth_info_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Value {
|
struct Value {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="value";
|
static constexpr const char _literal[] = R"("value")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Expires {
|
struct Expires {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="expires";
|
static constexpr const char _literal[] = R"("expires")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -66,7 +66,7 @@ namespace eedb {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::time_point, sqlpp::tag::can_be_null>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ namespace eedb {
|
|||||||
auth_token_::Expires> {
|
auth_token_::Expires> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "auth_token";
|
static constexpr const char _literal[] = R"("auth_token")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -9,15 +9,15 @@ namespace eedb {
|
|||||||
|
|
||||||
namespace category_ {
|
namespace category_ {
|
||||||
|
|
||||||
struct Uid {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="uid";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T uid;
|
T id;
|
||||||
T &operator()() { return uid; }
|
T &operator()() { return id; }
|
||||||
const T &operator()() const { return uid; }
|
const T &operator()() const { return id; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Owner {
|
struct Owner {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="owner";
|
static constexpr const char _literal[] = R"("owner")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="group";
|
static constexpr const char _literal[] = R"("group")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Unixperms {
|
struct Unixperms {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="unixperms";
|
static constexpr const char _literal[] = R"("unixperms")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -71,7 +71,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Status {
|
struct Status {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="status";
|
static constexpr const char _literal[] = R"("status")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -86,7 +86,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Name {
|
struct Name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="name";
|
static constexpr const char _literal[] = R"("name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -99,30 +99,30 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Creation_date {
|
struct Created {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="creation_date";
|
static constexpr const char _literal[] = R"("created")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T creation_date;
|
T created;
|
||||||
T &operator()() { return creation_date; }
|
T &operator()() { return created; }
|
||||||
const T &operator()() const { return creation_date; }
|
const T &operator()() const { return created; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Last_update {
|
struct Updated {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="last_update";
|
static constexpr const char _literal[] = R"("updated")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T last_update;
|
T updated;
|
||||||
T &operator()() { return last_update; }
|
T &operator()() { return updated; }
|
||||||
const T &operator()() const { return last_update; }
|
const T &operator()() const { return updated; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Parent_id {
|
struct Parent_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="parent_id";
|
static constexpr const char _literal[] = R"("parent_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -146,7 +146,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Description {
|
struct Description {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="description";
|
static constexpr const char _literal[] = R"("description")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -161,7 +161,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Parent_path {
|
struct Parent_path {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="parent_path";
|
static constexpr const char _literal[] = R"("parent_path")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -176,20 +176,20 @@ namespace eedb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct category : sqlpp::table_t<category,
|
struct category : sqlpp::table_t<category,
|
||||||
category_::Uid,
|
category_::Id,
|
||||||
category_::Owner,
|
category_::Owner,
|
||||||
category_::Group,
|
category_::Group,
|
||||||
category_::Unixperms,
|
category_::Unixperms,
|
||||||
category_::Status,
|
category_::Status,
|
||||||
category_::Name,
|
category_::Name,
|
||||||
category_::Creation_date,
|
category_::Created,
|
||||||
category_::Last_update,
|
category_::Updated,
|
||||||
category_::Parent_id,
|
category_::Parent_id,
|
||||||
category_::Description,
|
category_::Description,
|
||||||
category_::Parent_path> {
|
category_::Parent_path> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "category";
|
static constexpr const char _literal[] = R"("category")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
108
src/eedb/model/group.h
Normal file
108
src/eedb/model/group.h
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#ifndef EEDB_GROUP_H
|
||||||
|
#define EEDB_GROUP_H
|
||||||
|
|
||||||
|
#include <sqlpp11/table.h>
|
||||||
|
#include <sqlpp11/char_sequence.h>
|
||||||
|
#include <sqlpp11/column_types.h>
|
||||||
|
|
||||||
|
namespace eedb {
|
||||||
|
|
||||||
|
namespace group_ {
|
||||||
|
|
||||||
|
struct Gid {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("gid")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T gid;
|
||||||
|
T &operator()() { return gid; }
|
||||||
|
const T &operator()() const { return gid; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::must_not_insert, sqlpp::tag::must_not_update>;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Name {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("name")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T name;
|
||||||
|
T &operator()() { return name; }
|
||||||
|
const T &operator()() const { return name; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Description {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("description")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T description;
|
||||||
|
T &operator()() { return description; }
|
||||||
|
const T &operator()() const { return description; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Created {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("created")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T created;
|
||||||
|
T &operator()() { return created; }
|
||||||
|
const T &operator()() const { return created; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Updated {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("updated")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T updated;
|
||||||
|
T &operator()() { return updated; }
|
||||||
|
const T &operator()() const { return updated; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point, sqlpp::tag::can_be_null>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct group : sqlpp::table_t<group,
|
||||||
|
group_::Gid,
|
||||||
|
group_::Name,
|
||||||
|
group_::Description,
|
||||||
|
group_::Created,
|
||||||
|
group_::Updated> {
|
||||||
|
using _value_type = sqlpp::no_value_t;
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("group")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T group;
|
||||||
|
T &operator()() { return group; }
|
||||||
|
const T &operator()() const { return group; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Table_name {
|
struct Table_name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="table_name";
|
static constexpr const char _literal[] = R"("table_name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Action {
|
struct Action {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="action";
|
static constexpr const char _literal[] = R"("action")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Status {
|
struct Status {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="status";
|
static constexpr const char _literal[] = R"("status")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -61,7 +61,7 @@ namespace eedb {
|
|||||||
implemented_action_::Status> {
|
implemented_action_::Status> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "implemented_action";
|
static constexpr const char _literal[] = R"("implemented_action")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -9,15 +9,15 @@ namespace eedb {
|
|||||||
|
|
||||||
namespace inventory_ {
|
namespace inventory_ {
|
||||||
|
|
||||||
struct Uid {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="uid";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T uid;
|
T id;
|
||||||
T &operator()() { return uid; }
|
T &operator()() { return id; }
|
||||||
const T &operator()() const { return uid; }
|
const T &operator()() const { return id; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Owner {
|
struct Owner {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="owner";
|
static constexpr const char _literal[] = R"("owner")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="group";
|
static constexpr const char _literal[] = R"("group")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Unixperms {
|
struct Unixperms {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="unixperms";
|
static constexpr const char _literal[] = R"("unixperms")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -71,7 +71,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Status {
|
struct Status {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="status";
|
static constexpr const char _literal[] = R"("status")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -86,7 +86,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Name {
|
struct Name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="name";
|
static constexpr const char _literal[] = R"("name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -99,30 +99,30 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Creation_date {
|
struct Created {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="creation_date";
|
static constexpr const char _literal[] = R"("created")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T creation_date;
|
T created;
|
||||||
T &operator()() { return creation_date; }
|
T &operator()() { return created; }
|
||||||
const T &operator()() const { return creation_date; }
|
const T &operator()() const { return created; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Last_update {
|
struct Updated {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="last_update";
|
static constexpr const char _literal[] = R"("updated")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T last_update;
|
T updated;
|
||||||
T &operator()() { return last_update; }
|
T &operator()() { return updated; }
|
||||||
const T &operator()() const { return last_update; }
|
const T &operator()() const { return updated; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Description {
|
struct Description {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="description";
|
static constexpr const char _literal[] = R"("description")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -146,18 +146,18 @@ namespace eedb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct inventory : sqlpp::table_t<inventory,
|
struct inventory : sqlpp::table_t<inventory,
|
||||||
inventory_::Uid,
|
inventory_::Id,
|
||||||
inventory_::Owner,
|
inventory_::Owner,
|
||||||
inventory_::Group,
|
inventory_::Group,
|
||||||
inventory_::Unixperms,
|
inventory_::Unixperms,
|
||||||
inventory_::Status,
|
inventory_::Status,
|
||||||
inventory_::Name,
|
inventory_::Name,
|
||||||
inventory_::Creation_date,
|
inventory_::Created,
|
||||||
inventory_::Last_update,
|
inventory_::Updated,
|
||||||
inventory_::Description> {
|
inventory_::Description> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "inventory";
|
static constexpr const char _literal[] = R"("inventory")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -9,15 +9,15 @@ namespace eedb {
|
|||||||
|
|
||||||
namespace item_ {
|
namespace item_ {
|
||||||
|
|
||||||
struct Uid {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="uid";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T uid;
|
T id;
|
||||||
T &operator()() { return uid; }
|
T &operator()() { return id; }
|
||||||
const T &operator()() const { return uid; }
|
const T &operator()() const { return id; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Owner {
|
struct Owner {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="owner";
|
static constexpr const char _literal[] = R"("owner")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="group";
|
static constexpr const char _literal[] = R"("group")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Unixperms {
|
struct Unixperms {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="unixperms";
|
static constexpr const char _literal[] = R"("unixperms")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -71,7 +71,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Status {
|
struct Status {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="status";
|
static constexpr const char _literal[] = R"("status")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -86,7 +86,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Name {
|
struct Name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="name";
|
static constexpr const char _literal[] = R"("name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -99,30 +99,30 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Creation_date {
|
struct Created {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="creation_date";
|
static constexpr const char _literal[] = R"("created")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T creation_date;
|
T created;
|
||||||
T &operator()() { return creation_date; }
|
T &operator()() { return created; }
|
||||||
const T &operator()() const { return creation_date; }
|
const T &operator()() const { return created; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Last_update {
|
struct Updated {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="last_update";
|
static constexpr const char _literal[] = R"("updated")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T last_update;
|
T updated;
|
||||||
T &operator()() { return last_update; }
|
T &operator()() { return updated; }
|
||||||
const T &operator()() const { return last_update; }
|
const T &operator()() const { return updated; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Category_id {
|
struct Category_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="category_id";
|
static constexpr const char _literal[] = R"("category_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -146,7 +146,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Symbol {
|
struct Symbol {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="symbol";
|
static constexpr const char _literal[] = R"("symbol")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -161,7 +161,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Original_symbol {
|
struct Original_symbol {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="original_symbol";
|
static constexpr const char _literal[] = R"("original_symbol")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -176,7 +176,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Producer {
|
struct Producer {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="producer";
|
static constexpr const char _literal[] = R"("producer")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -189,9 +189,24 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Visibility {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("visibility")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T visibility;
|
||||||
|
T &operator()() { return visibility; }
|
||||||
|
const T &operator()() const { return visibility; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::varchar>;
|
||||||
|
};
|
||||||
|
|
||||||
struct Attributes {
|
struct Attributes {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="attributes";
|
static constexpr const char _literal[] = R"("attributes")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -206,7 +221,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Description {
|
struct Description {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="description";
|
static constexpr const char _literal[] = R"("description")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -221,23 +236,24 @@ namespace eedb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct item : sqlpp::table_t<item,
|
struct item : sqlpp::table_t<item,
|
||||||
item_::Uid,
|
item_::Id,
|
||||||
item_::Owner,
|
item_::Owner,
|
||||||
item_::Group,
|
item_::Group,
|
||||||
item_::Unixperms,
|
item_::Unixperms,
|
||||||
item_::Status,
|
item_::Status,
|
||||||
item_::Name,
|
item_::Name,
|
||||||
item_::Creation_date,
|
item_::Created,
|
||||||
item_::Last_update,
|
item_::Updated,
|
||||||
item_::Category_id,
|
item_::Category_id,
|
||||||
item_::Symbol,
|
item_::Symbol,
|
||||||
item_::Original_symbol,
|
item_::Original_symbol,
|
||||||
item_::Producer,
|
item_::Producer,
|
||||||
|
item_::Visibility,
|
||||||
item_::Attributes,
|
item_::Attributes,
|
||||||
item_::Description> {
|
item_::Description> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "item";
|
static constexpr const char _literal[] = R"("item")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Role {
|
struct Role {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="role";
|
static constexpr const char _literal[] = R"("role")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Who {
|
struct Who {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="who";
|
static constexpr const char _literal[] = R"("who")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Action {
|
struct Action {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="action";
|
static constexpr const char _literal[] = R"("action")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Type {
|
struct Type {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="type";
|
static constexpr const char _literal[] = R"("type")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -71,7 +71,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Related_table_name {
|
struct Related_table_name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="related_table_name";
|
static constexpr const char _literal[] = R"("related_table_name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -86,7 +86,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Related_object_uid {
|
struct Related_object_uid {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="related_object_uid";
|
static constexpr const char _literal[] = R"("related_object_uid")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -109,7 +109,7 @@ namespace eedb {
|
|||||||
privilege_::Related_object_uid> {
|
privilege_::Related_object_uid> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "privilege";
|
static constexpr const char _literal[] = R"("privilege")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -9,15 +9,15 @@ namespace eedb {
|
|||||||
|
|
||||||
namespace stat_ {
|
namespace stat_ {
|
||||||
|
|
||||||
struct Uid {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="uid";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T uid;
|
T id;
|
||||||
T &operator()() { return uid; }
|
T &operator()() { return id; }
|
||||||
const T &operator()() const { return uid; }
|
const T &operator()() const { return id; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Owner {
|
struct Owner {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="owner";
|
static constexpr const char _literal[] = R"("owner")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="group";
|
static constexpr const char _literal[] = R"("group")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Unixperms {
|
struct Unixperms {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="unixperms";
|
static constexpr const char _literal[] = R"("unixperms")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -71,7 +71,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Status {
|
struct Status {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="status";
|
static constexpr const char _literal[] = R"("status")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -86,7 +86,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Name {
|
struct Name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="name";
|
static constexpr const char _literal[] = R"("name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -99,30 +99,30 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Creation_date {
|
struct Created {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="creation_date";
|
static constexpr const char _literal[] = R"("created")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T creation_date;
|
T created;
|
||||||
T &operator()() { return creation_date; }
|
T &operator()() { return created; }
|
||||||
const T &operator()() const { return creation_date; }
|
const T &operator()() const { return created; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Last_update {
|
struct Updated {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="last_update";
|
static constexpr const char _literal[] = R"("updated")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T last_update;
|
T updated;
|
||||||
T &operator()() { return last_update; }
|
T &operator()() { return updated; }
|
||||||
const T &operator()() const { return last_update; }
|
const T &operator()() const { return updated; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -131,17 +131,17 @@ namespace eedb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct stat : sqlpp::table_t<stat,
|
struct stat : sqlpp::table_t<stat,
|
||||||
stat_::Uid,
|
stat_::Id,
|
||||||
stat_::Owner,
|
stat_::Owner,
|
||||||
stat_::Group,
|
stat_::Group,
|
||||||
stat_::Unixperms,
|
stat_::Unixperms,
|
||||||
stat_::Status,
|
stat_::Status,
|
||||||
stat_::Name,
|
stat_::Name,
|
||||||
stat_::Creation_date,
|
stat_::Created,
|
||||||
stat_::Last_update> {
|
stat_::Updated> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "stat";
|
static constexpr const char _literal[] = R"("stat")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Id {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="id";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Name {
|
struct Name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="name";
|
static constexpr const char _literal[] = R"("name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Value {
|
struct Value {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="value";
|
static constexpr const char _literal[] = R"("value")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -54,15 +54,15 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Creation_time {
|
struct When {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="creation_time";
|
static constexpr const char _literal[] = R"("when")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T creation_time;
|
T when;
|
||||||
T &operator()() { return creation_time; }
|
T &operator()() { return when; }
|
||||||
const T &operator()() const { return creation_time; }
|
const T &operator()() const { return when; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -74,10 +74,10 @@ namespace eedb {
|
|||||||
system_info_::Id,
|
system_info_::Id,
|
||||||
system_info_::Name,
|
system_info_::Name,
|
||||||
system_info_::Value,
|
system_info_::Value,
|
||||||
system_info_::Creation_time> {
|
system_info_::When> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "system_info";
|
static constexpr const char _literal[] = R"("system_info")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Uid {
|
struct Uid {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="uid";
|
static constexpr const char _literal[] = R"("uid")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -21,27 +21,12 @@ namespace eedb {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::integer>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::must_not_insert, sqlpp::tag::must_not_update>;
|
||||||
};
|
|
||||||
|
|
||||||
struct Owner {
|
|
||||||
struct _alias_t {
|
|
||||||
static constexpr const char _literal[] ="owner";
|
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
|
||||||
template<typename T>
|
|
||||||
struct _member_t {
|
|
||||||
T owner;
|
|
||||||
T &operator()() { return owner; }
|
|
||||||
const T &operator()() const { return owner; }
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::integer>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="group";
|
static constexpr const char _literal[] = R"("group")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -54,24 +39,9 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::integer>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Unixperms {
|
|
||||||
struct _alias_t {
|
|
||||||
static constexpr const char _literal[] ="unixperms";
|
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
|
||||||
template<typename T>
|
|
||||||
struct _member_t {
|
|
||||||
T unixperms;
|
|
||||||
T &operator()() { return unixperms; }
|
|
||||||
const T &operator()() const { return unixperms; }
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::integer>;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Status {
|
struct Status {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="status";
|
static constexpr const char _literal[] = R"("status")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -84,69 +54,54 @@ namespace eedb {
|
|||||||
using _traits = ::sqlpp::make_traits<::sqlpp::integer>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Name {
|
struct Full_name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="name";
|
static constexpr const char _literal[] = R"("full_name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T name;
|
T full_name;
|
||||||
T &operator()() { return name; }
|
T &operator()() { return full_name; }
|
||||||
const T &operator()() const { return name; }
|
const T &operator()() const { return full_name; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::require_insert>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Creation_date {
|
struct Created {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="creation_date";
|
static constexpr const char _literal[] = R"("created")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T creation_date;
|
T created;
|
||||||
T &operator()() { return creation_date; }
|
T &operator()() { return created; }
|
||||||
const T &operator()() const { return creation_date; }
|
const T &operator()() const { return created; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Last_update {
|
struct Updated {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="last_update";
|
static constexpr const char _literal[] = R"("updated")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T last_update;
|
T updated;
|
||||||
T &operator()() { return last_update; }
|
T &operator()() { return updated; }
|
||||||
const T &operator()() const { return last_update; }
|
const T &operator()() const { return updated; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::time_point, sqlpp::tag::can_be_null>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::time_point, sqlpp::tag::can_be_null>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Address {
|
|
||||||
struct _alias_t {
|
|
||||||
static constexpr const char _literal[] ="address";
|
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
|
||||||
template<typename T>
|
|
||||||
struct _member_t {
|
|
||||||
T address;
|
|
||||||
T &operator()() { return address; }
|
|
||||||
const T &operator()() const { return address; }
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Config {
|
struct Config {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="config";
|
static constexpr const char _literal[] = R"("config")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -156,56 +111,37 @@ namespace eedb {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::text>;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Avatar {
|
struct Auth_info_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="avatar";
|
static constexpr const char _literal[] = R"("auth_info_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T avatar;
|
T auth_info_id;
|
||||||
T &operator()() { return avatar; }
|
T &operator()() { return auth_info_id; }
|
||||||
const T &operator()() const { return avatar; }
|
const T &operator()() const { return auth_info_id; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
using _traits = ::sqlpp::make_traits<::sqlpp::bigint, sqlpp::tag::can_be_null>;
|
||||||
};
|
|
||||||
|
|
||||||
struct Email {
|
|
||||||
struct _alias_t {
|
|
||||||
static constexpr const char _literal[] ="email";
|
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
|
||||||
template<typename T>
|
|
||||||
struct _member_t {
|
|
||||||
T email;
|
|
||||||
T &operator()() { return email; }
|
|
||||||
const T &operator()() const { return email; }
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
using _traits = ::sqlpp::make_traits<::sqlpp::varchar, sqlpp::tag::require_insert>;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
struct user : sqlpp::table_t<user,
|
struct user : sqlpp::table_t<user,
|
||||||
user_::Uid,
|
user_::Uid,
|
||||||
user_::Owner,
|
|
||||||
user_::Group,
|
user_::Group,
|
||||||
user_::Unixperms,
|
|
||||||
user_::Status,
|
user_::Status,
|
||||||
user_::Name,
|
user_::Full_name,
|
||||||
user_::Creation_date,
|
user_::Created,
|
||||||
user_::Last_update,
|
user_::Updated,
|
||||||
user_::Address,
|
|
||||||
user_::Config,
|
user_::Config,
|
||||||
user_::Avatar,
|
user_::Auth_info_id> {
|
||||||
user_::Email> {
|
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "\"user\"";
|
static constexpr const char _literal[] = R"("user")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Id {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="id";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Name {
|
struct Name {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="name";
|
static constexpr const char _literal[] = R"("name")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -45,7 +45,7 @@ namespace eedb {
|
|||||||
user_action_::Name> {
|
user_action_::Name> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "user_action";
|
static constexpr const char _literal[] = R"("user_action")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef EEDB_USER_HISTORY_H
|
#ifndef EEDB_USER_AUDIT_H
|
||||||
#define EEDB_USER_HISTORY_H
|
#define EEDB_USER_AUDIT_H
|
||||||
|
|
||||||
#include <sqlpp11/table.h>
|
#include <sqlpp11/table.h>
|
||||||
#include <sqlpp11/char_sequence.h>
|
#include <sqlpp11/char_sequence.h>
|
||||||
@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
namespace eedb {
|
namespace eedb {
|
||||||
|
|
||||||
namespace user_history_ {
|
namespace user_audit_ {
|
||||||
|
|
||||||
struct Id {
|
struct Id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="id";
|
static constexpr const char _literal[] = R"("id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct User_id {
|
struct User_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="user_id";
|
static constexpr const char _literal[] = R"("user_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -41,7 +41,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Action_id {
|
struct Action_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="action_id";
|
static constexpr const char _literal[] = R"("action_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -56,7 +56,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Data {
|
struct Data {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="data";
|
static constexpr const char _literal[] = R"("data")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -71,7 +71,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct When {
|
struct When {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="when";
|
static constexpr const char _literal[] = R"("when")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -85,21 +85,21 @@ namespace eedb {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
struct user_history : sqlpp::table_t<user_history,
|
struct user_audit : sqlpp::table_t<user_audit,
|
||||||
user_history_::Id,
|
user_audit_::Id,
|
||||||
user_history_::User_id,
|
user_audit_::User_id,
|
||||||
user_history_::Action_id,
|
user_audit_::Action_id,
|
||||||
user_history_::Data,
|
user_audit_::Data,
|
||||||
user_history_::When> {
|
user_audit_::When> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "user_history";
|
static constexpr const char _literal[] = R"("user_audit")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
T user_history;
|
T user_audit;
|
||||||
T &operator()() { return user_history; }
|
T &operator()() { return user_audit; }
|
||||||
const T &operator()() const { return user_history; }
|
const T &operator()() const { return user_audit; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
60
src/eedb/model/user_audit_action.h
Normal file
60
src/eedb/model/user_audit_action.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#ifndef EEDB_USER_AUDIT_ACTION_H
|
||||||
|
#define EEDB_USER_AUDIT_ACTION_H
|
||||||
|
|
||||||
|
#include <sqlpp11/table.h>
|
||||||
|
#include <sqlpp11/char_sequence.h>
|
||||||
|
#include <sqlpp11/column_types.h>
|
||||||
|
|
||||||
|
namespace eedb {
|
||||||
|
|
||||||
|
namespace user_audit_action_ {
|
||||||
|
|
||||||
|
struct Id {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("id")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T id;
|
||||||
|
T &operator()() { return id; }
|
||||||
|
const T &operator()() const { return id; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::must_not_insert, sqlpp::tag::must_not_update>;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Name {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("name")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T name;
|
||||||
|
T &operator()() { return name; }
|
||||||
|
const T &operator()() const { return name; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::text, sqlpp::tag::can_be_null>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct user_audit_action : sqlpp::table_t<user_audit_action,
|
||||||
|
user_audit_action_::Id,
|
||||||
|
user_audit_action_::Name> {
|
||||||
|
using _value_type = sqlpp::no_value_t;
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("user_audit_action")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T user_audit_action;
|
||||||
|
T &operator()() { return user_audit_action; }
|
||||||
|
const T &operator()() const { return user_audit_action; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
60
src/eedb/model/user_groups.h
Normal file
60
src/eedb/model/user_groups.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#ifndef EEDB_USER_GROUPS_H
|
||||||
|
#define EEDB_USER_GROUPS_H
|
||||||
|
|
||||||
|
#include <sqlpp11/table.h>
|
||||||
|
#include <sqlpp11/char_sequence.h>
|
||||||
|
#include <sqlpp11/column_types.h>
|
||||||
|
|
||||||
|
namespace eedb {
|
||||||
|
|
||||||
|
namespace user_groups_ {
|
||||||
|
|
||||||
|
struct Uid {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("uid")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T uid;
|
||||||
|
T &operator()() { return uid; }
|
||||||
|
const T &operator()() const { return uid; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::require_insert>;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Gid {
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("gid")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T gid;
|
||||||
|
T &operator()() { return gid; }
|
||||||
|
const T &operator()() const { return gid; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
using _traits = ::sqlpp::make_traits<::sqlpp::integer, sqlpp::tag::require_insert>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct user_groups : sqlpp::table_t<user_groups,
|
||||||
|
user_groups_::Uid,
|
||||||
|
user_groups_::Gid> {
|
||||||
|
using _value_type = sqlpp::no_value_t;
|
||||||
|
struct _alias_t {
|
||||||
|
static constexpr const char _literal[] = R"("user_groups")";
|
||||||
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
|
template<typename T>
|
||||||
|
struct _member_t {
|
||||||
|
T user_groups;
|
||||||
|
T &operator()() { return user_groups; }
|
||||||
|
const T &operator()() const { return user_groups; }
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -11,7 +11,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct User_id {
|
struct User_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="user_id";
|
static constexpr const char _literal[] = R"("user_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -26,7 +26,7 @@ namespace eedb {
|
|||||||
|
|
||||||
struct Inventory_id {
|
struct Inventory_id {
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] ="inventory_id";
|
static constexpr const char _literal[] = R"("inventory_id")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
@ -45,7 +45,7 @@ namespace eedb {
|
|||||||
user_inventory_::Inventory_id> {
|
user_inventory_::Inventory_id> {
|
||||||
using _value_type = sqlpp::no_value_t;
|
using _value_type = sqlpp::no_value_t;
|
||||||
struct _alias_t {
|
struct _alias_t {
|
||||||
static constexpr const char _literal[] = "user_inventory";
|
static constexpr const char _literal[] = R"("user_inventory")";
|
||||||
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
using _name_t = sqlpp::make_char_sequence<sizeof(_literal), _literal>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _member_t {
|
struct _member_t {
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
#include <eedb/auth/Services.hpp>
|
||||||
|
#include <eedb/widgets/AuthWidget.hpp>
|
||||||
|
|
||||||
|
namespace eedb {
|
||||||
|
AuthWidget::AuthWidget(
|
||||||
|
const auth::Services & baseAuth, Wt::Auth::AbstractUserDatabase & users, Wt::Auth::Login & login, Wt::WContainerWidget * parent)
|
||||||
|
: Wt::Auth::AuthWidget(*baseAuth.authService(), users, login, parent) {
|
||||||
|
this->model()->addPasswordAuth(eedb::auth::Services::passwordService());
|
||||||
|
this->model()->addOAuth(eedb::auth::Services::oAuthServices());
|
||||||
|
this->setRegistrationEnabled(true);
|
||||||
|
this->processEnvironment();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,24 @@
|
|||||||
#pragma once
|
#include <Wt/Auth/AuthWidget>
|
||||||
|
|
||||||
|
namespace eedb::auth {
|
||||||
|
class Services;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Wt {
|
||||||
|
class WContainerWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Wt::Auth {
|
||||||
|
class AbstractUserDatabase;
|
||||||
|
class Login;
|
||||||
|
}
|
||||||
|
|
||||||
namespace eedb {
|
namespace eedb {
|
||||||
|
class AuthWidget : public Wt::Auth::AuthWidget {
|
||||||
|
using _base = Wt::Auth::AuthWidget;
|
||||||
|
|
||||||
class AuthWidget {};
|
public:
|
||||||
|
AuthWidget(const eedb::auth::Services & baseAuth, Wt::Auth::AbstractUserDatabase & users, Wt::Auth::Login & login,
|
||||||
|
Wt::WContainerWidget * parent = nullptr);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/eedb/widgets/Theme.cpp
Normal file
14
src/eedb/widgets/Theme.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <eedb/widgets/Theme.hpp>
|
||||||
|
|
||||||
|
#include <Wt/WBootstrapTheme>
|
||||||
|
|
||||||
|
namespace eedb {
|
||||||
|
BootstrapTheme::BootstrapTheme(Wt::WObject * parent) : _parent(parent) {}
|
||||||
|
|
||||||
|
Wt::WTheme * BootstrapTheme::create() const {
|
||||||
|
auto theme = new Wt::WBootstrapTheme(_parent);
|
||||||
|
theme->setVersion(Wt::WBootstrapTheme::Version3);
|
||||||
|
theme->setResponsive(true);
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/eedb/widgets/Theme.hpp
Normal file
15
src/eedb/widgets/Theme.hpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace Wt {
|
||||||
|
class WTheme;
|
||||||
|
class WObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace eedb {
|
||||||
|
class BootstrapTheme {
|
||||||
|
public:
|
||||||
|
BootstrapTheme(Wt::WObject * parent);
|
||||||
|
Wt::WTheme * create() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Wt::WObject * _parent;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user