start on token work

This commit is contained in:
Cadey Ratio 2020-10-28 09:49:59 -04:00
parent 5d273dbf1c
commit 75c9823e76
3 changed files with 24 additions and 4 deletions

View File

@ -1,2 +1,8 @@
[global.limits]
json = 5242880
[global.oauth.gitea]
provider = { auth_uri = "https://tulpa.dev/login/oauth/authorize", token_uri = "https://tulpa.dev/login/oauth/access_token" }
client_id = "..."
client_secret = "..."
redirect_uri = "http://localhost:8000/auth/gitea"

View File

@ -3,7 +3,7 @@ let
rust = import ./nix/rust.nix { inherit sources; };
pkgs = import sources.nixpkgs { };
in pkgs.mkShell rec {
buildInputs = with pkgs; [ rust diesel-cli postgresql pgcli ];
buildInputs = with pkgs; [ rust diesel-cli postgresql pgcli cargo-watch ];
DATABASE_URL = "postgresql://postgres:hunter2@localhost:5432/wasmcloud";
ROCKET_DATABASES = ''

View File

@ -1,4 +1,4 @@
use crate::schema::{gitea_tokens, users};
use crate::schema::{gitea_tokens, users, tokens};
use chrono::NaiveDateTime;
use serde::Serialize;
use uuid::Uuid;
@ -33,8 +33,7 @@ pub struct NewGiteaToken {
pub refresh_token: String,
}
#[derive(Insertable, Queryable, Debug, Clone)]
#[table_name = "gitea_tokens"]
#[derive(Queryable, Debug, Clone)]
pub struct GiteaToken {
pub id: Uuid,
pub user_id: Uuid,
@ -43,3 +42,18 @@ pub struct GiteaToken {
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
}
#[derive(Insertable)]
#[table_name="tokens"]
pub struct NewToken {
pub user_id: Uuid,
}
#[derive(Queryable, Debug, Clone, Serialize)]
pub struct Token {
pub id: Uuid,
pub user_id: Uuid,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub deleted_at: Option<NaiveDateTime>,
}