apps: sql + get valid one, get by id, insert, generate app id, generate secret

This commit is contained in:
Philippe Loctaux 2023-03-15 22:00:04 +01:00
parent b5c2be6c9f
commit 71b083895d
19 changed files with 490 additions and 0 deletions

View file

@ -0,0 +1 @@
drop table if exists apps;

View file

@ -0,0 +1,22 @@
create table if not exists apps
(
id TEXT not null primary key,
created_at TEXT not null default CURRENT_TIMESTAMP,
updated_at TEXT not null default CURRENT_TIMESTAMP,
label TEXT not null,
redirect_uri TEXT not null,
secret TEXT not null,
is_confidential INTEGER not null,
is_archived INTEGER not null default 0
);
-- update "updated_at"
create trigger if not exists apps_updated_at
after update
on apps
for each row
begin
update apps
set updated_at = CURRENT_TIMESTAMP
where id is NEW.id;
end;