mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-21 23:33:34 +00:00
fix: oauth2 query
This commit is contained in:
parent
8c4fc83ca0
commit
7035afe008
3 changed files with 10 additions and 8 deletions
|
@ -1,7 +1,8 @@
|
|||
-- +migrate Up
|
||||
CREATE TABLE oauth2_states (
|
||||
state TEXT,
|
||||
expiry DATETIME,
|
||||
state TEXT,
|
||||
expires_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
PRIMARY KEY (state)
|
||||
);
|
||||
|
||||
|
@ -33,7 +34,8 @@ CREATE TABLE worker_groups (
|
|||
|
||||
CREATE TABLE monitor_worker_groups (
|
||||
worker_group_slug TEXT,
|
||||
monitor_slug TEXT,
|
||||
monitor_slug TEXT,
|
||||
|
||||
PRIMARY KEY (worker_group_slug,monitor_slug),
|
||||
CONSTRAINT fk_monitor_worker_groups_worker_group FOREIGN KEY (worker_group_slug) REFERENCES worker_groups(slug),
|
||||
CONSTRAINT fk_monitor_worker_groups_monitor FOREIGN KEY (monitor_slug) REFERENCES monitors(slug)
|
||||
|
@ -41,8 +43,8 @@ CREATE TABLE monitor_worker_groups (
|
|||
|
||||
CREATE TABLE monitor_histories (
|
||||
monitor_slug TEXT,
|
||||
status TEXT,
|
||||
note TEXT,
|
||||
status TEXT,
|
||||
note TEXT,
|
||||
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ primary_region = 'waw'
|
|||
ROOT_URL = 'https://zdravko.mnts.dev'
|
||||
TEMPORAL_SERVER_HOST = 'server.process.zdravko.internal:7233'
|
||||
|
||||
TEMPORAL_DATABASE_PATH = '/data/temporal-5.db'
|
||||
DATABASE_PATH = '/data/zdravko-5.db'
|
||||
TEMPORAL_DATABASE_PATH = '/data/temporal-6.db'
|
||||
DATABASE_PATH = '/data/zdravko-6.db'
|
||||
|
||||
[processes]
|
||||
server = '--temporal --server'
|
||||
|
|
|
@ -16,7 +16,7 @@ func CreateOAuth2State(ctx context.Context, db *sqlx.DB, oauth2State *models.OAu
|
|||
}
|
||||
|
||||
func DeleteOAuth2State(ctx context.Context, db *sqlx.DB, state string) (deleted bool, err error) {
|
||||
res, err := db.ExecContext(ctx, "DELETE FROM oauth2_states WHERE state = $1 AND expires_at > NOW()", state)
|
||||
res, err := db.ExecContext(ctx, "DELETE FROM oauth2_states WHERE state = $1 AND expires_at > datetime('now')", state)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue