Skip to content

Commit

Permalink
update(server): add missing project id's
Browse files Browse the repository at this point in the history
  • Loading branch information
mochicode committed Jul 3, 2022
1 parent 79cc5ae commit 81ea7e3
Show file tree
Hide file tree
Showing 52 changed files with 554 additions and 419 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.06.0-alpha
22.7.0-alpha
5 changes: 0 additions & 5 deletions packages/rust/sdk/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ async fn verify_jwt() {
let expire_at = Utc::now() + Duration::minutes(15);
for keypair in keypairs.iter() {
let payload = Claims {
iss: keypair.id,
exp: expire_at.timestamp(),
sub: Uuid::new_v4(),
traits: vec![],
Expand All @@ -121,7 +120,6 @@ async fn verify_token_expired() {
let expire_at = Utc::now() - Duration::minutes(15);
for keypair in keypairs.iter() {
let payload = Claims {
iss: keypair.id,
exp: expire_at.timestamp(),
sub: Uuid::new_v4(),
traits: vec![],
Expand All @@ -145,7 +143,6 @@ async fn verify_token_fails_for_missing_key() {
let keypair = keypairs.get(0).unwrap();

let payload = Claims {
iss: Uuid::new_v4(),
exp: expire_at.timestamp(),
sub: Uuid::new_v4(),
traits: vec![],
Expand All @@ -165,11 +162,9 @@ async fn verify_token_invalid_token() {
let auth = AuthKeys::init("http://localhost:7000").await.unwrap();

let expire_at = Utc::now() + Duration::minutes(15);
let keypair = keypairs.get(0).unwrap();
let keypair2 = keypairs.get(1).unwrap();

let payload = Claims {
iss: keypair.id,
exp: expire_at.timestamp(),
sub: Uuid::new_v4(),
traits: vec![],
Expand Down
2 changes: 1 addition & 1 deletion scripts/seeds/data/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export let project = {

export let projectSettings = {
name: 'Development',
domain: 'http://localhost:4200',
domain: 'http://localhost:5000',
project_id: project.id,
}

Expand Down
3 changes: 3 additions & 0 deletions scripts/seeds/dev/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ exports.seed = async function(knex: Knex) {
user_id: u.id,
alg: 'bcrypt',
hash: password,
project_id: u.project_id,
}
})
)
Expand Down Expand Up @@ -93,6 +94,7 @@ exports.seed = async function(knex: Knex) {
subject: t.subject,
redirect_to: t.redirect_to,
of_type: t.of_type,
project_id: t.project_id,
}
})
)
Expand All @@ -104,6 +106,7 @@ exports.seed = async function(knex: Knex) {
template_id: t.id,
language: 'en',
content: t.translation,
project_id: t.project_id,
}
})
)
Expand Down
2 changes: 1 addition & 1 deletion server/migrations/2020-11-28-215246_create_session/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
create table if not exists sessions
( id uuid primary key default uuid_generate_v4()
, expire_at timestamptz not null default now() + '30 days'
, project_id uuid references projects(id) on delete cascade
, project_id uuid not null references projects(id) on delete cascade
, created_at timestamptz not null default now()
, public_key bytea not null
, user_id uuid references users(id) on delete cascade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ create type password_alg as enum('bcrypt', 'argon2id', 'sha1', 'scrypt', 'pbkdf2

create table if not exists passwords
( user_id uuid primary key references users(id) on delete cascade
, project_id uuid not null references projects(id) on delete cascade
, alg password_alg not null default 'argon2id'
, hash text not null
, updated_at timestamptz not null default now()
Expand Down
6 changes: 4 additions & 2 deletions server/migrations/2021-02-12-210113_create_template/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ create table if not exists templates
);

create table if not exists template_data
( from_name text not null
( project_id uuid not null references projects(id) on delete cascade
, from_name text not null
, subject text not null
, template_id uuid not null references templates(id) on delete cascade
, redirect_to text not null
Expand All @@ -19,7 +20,8 @@ create table if not exists template_data
);

create table if not exists template_translations
( template_id uuid not null references templates(id) on delete cascade
( project_id uuid not null references projects(id) on delete cascade
, template_id uuid not null references templates(id) on delete cascade
, language text not null default 'en'
, content jsonb not null
, primary key(template_id, language)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

create table if not exists refresh_access_tokens
( id uuid primary key
, project_id uuid not null references projects(id) on delete cascade
, session_id uuid not null references sessions(id) on delete cascade
, expire_at timestamptz not null default now() + '30 minutes'
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ create table if not exists email_change_request
, old_email text not null
, new_email text not null
, user_id uuid not null references users(id) on delete cascade
, project_id uuid not null references projects(id) on delete cascade
, token text not null
, reset_token text not null
, state email_change_state not null default 'request'
Expand Down
1 change: 1 addition & 0 deletions server/migrations/2021-10-02-203303_create_api_keys/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ create table if not exists api_keys
, token text not null
, name text
, user_id uuid not null references users(id) on delete cascade
, project_id uuid not null references projects(id) on delete cascade
, expire_at timestamptz
, created_at timestamptz not null default now()
);
1 change: 1 addition & 0 deletions server/migrations/2022-05-02-141736_create_oauth/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ create table if not exists oauth_data

create table if not exists oauth_request_state
( request_id uuid primary key default uuid_generate_v4()
, project_id uuid not null references projects(id) on delete cascade
, csrf_token text not null
, pkce_code_verifier text
, created_at timestamptz not null default now()
Expand Down
Loading

0 comments on commit 81ea7e3

Please sign in to comment.