Skip to content

Commit

Permalink
style(rustfmt): Switch to tabs for formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdenio committed Oct 13, 2021
1 parent b645895 commit d93b3f2
Show file tree
Hide file tree
Showing 29 changed files with 1,219 additions and 1,218 deletions.
20 changes: 10 additions & 10 deletions crates/db_models/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Queryable, Serialize, Identifiable, Associations)]
#[belongs_to(Team)]
pub struct App {
pub id: i32,
pub created_at: NaiveDateTime,
pub slug: String,
pub team_id: i32,
pub enabled: bool,
#[serde(skip_serializing)]
pub container_id: Option<String>,
pub id: i32,
pub created_at: NaiveDateTime,
pub slug: String,
pub team_id: i32,
pub enabled: bool,
#[serde(skip_serializing)]
pub container_id: Option<String>,
}

#[derive(Insertable, Deserialize, Debug)]
#[table_name = "apps"]
pub struct NewApp {
pub slug: String,
#[serde(skip_deserializing)]
pub team_id: i32,
pub slug: String,
#[serde(skip_deserializing)]
pub team_id: i32,
}
18 changes: 9 additions & 9 deletions crates/db_models/src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Queryable, Serialize, Identifiable, Associations)]
#[belongs_to(App)]
pub struct Domain {
pub id: i32,
pub domain: String,
pub verified: bool,
pub app_id: i32,
pub id: i32,
pub domain: String,
pub verified: bool,
pub app_id: i32,
}

#[derive(Deserialize, Debug, Insertable)]
#[table_name = "domains"]
pub struct NewDomain {
pub domain: String,
#[serde(skip_deserializing)]
pub verified: bool,
#[serde(skip_deserializing)]
pub app_id: i32,
pub domain: String,
#[serde(skip_deserializing)]
pub verified: bool,
#[serde(skip_deserializing)]
pub app_id: i32,
}
4 changes: 2 additions & 2 deletions crates/db_models/src/oauth_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ use crate::schema::oauth_apps;
#[derive(Queryable, Debug, Identifiable)]
#[primary_key(client_id)]
pub struct OauthApp {
pub client_id: String,
pub name: String,
pub client_id: String,
pub name: String,
}
24 changes: 12 additions & 12 deletions crates/db_models/src/oauth_device_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ use chrono::NaiveDateTime;
#[belongs_to(OauthApp)]
#[belongs_to(Token, foreign_key = "token")]
pub struct OauthDeviceRequest {
pub id: i32,
pub created_at: NaiveDateTime,
pub expires_at: NaiveDateTime,
pub oauth_app_id: String,
pub token: Option<String>,
pub device_code: String,
pub user_code: String,
pub token_retrieved: bool,
pub access_denied: bool,
pub id: i32,
pub created_at: NaiveDateTime,
pub expires_at: NaiveDateTime,
pub oauth_app_id: String,
pub token: Option<String>,
pub device_code: String,
pub user_code: String,
pub token_retrieved: bool,
pub access_denied: bool,
}

#[derive(Insertable, Debug)]
#[table_name = "oauth_device_requests"]
pub struct NewOauthDeviceRequest<'a> {
pub oauth_app_id: &'a str,
pub device_code: &'a str,
pub user_code: &'a str,
pub oauth_app_id: &'a str,
pub device_code: &'a str,
pub user_code: &'a str,
}
132 changes: 66 additions & 66 deletions crates/db_models/src/schema.rs
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
table! {
apps (id) {
id -> Int4,
created_at -> Timestamp,
slug -> Text,
team_id -> Int4,
enabled -> Bool,
container_id -> Nullable<Text>,
}
apps (id) {
id -> Int4,
created_at -> Timestamp,
slug -> Text,
team_id -> Int4,
enabled -> Bool,
container_id -> Nullable<Text>,
}
}

table! {
domains (id) {
id -> Int4,
domain -> Text,
verified -> Bool,
app_id -> Int4,
}
domains (id) {
id -> Int4,
domain -> Text,
verified -> Bool,
app_id -> Int4,
}
}

table! {
oauth_apps (client_id) {
client_id -> Text,
name -> Text,
}
oauth_apps (client_id) {
client_id -> Text,
name -> Text,
}
}

table! {
oauth_device_requests (id) {
id -> Int4,
created_at -> Timestamp,
expires_at -> Timestamp,
oauth_app_id -> Text,
token -> Nullable<Text>,
device_code -> Text,
user_code -> Text,
token_retrieved -> Bool,
access_denied -> Bool,
}
oauth_device_requests (id) {
id -> Int4,
created_at -> Timestamp,
expires_at -> Timestamp,
oauth_app_id -> Text,
token -> Nullable<Text>,
device_code -> Text,
user_code -> Text,
token_retrieved -> Bool,
access_denied -> Bool,
}
}

table! {
team_users (team_id, user_id) {
user_id -> Int4,
team_id -> Int4,
}
team_users (team_id, user_id) {
user_id -> Int4,
team_id -> Int4,
}
}

table! {
teams (id) {
id -> Int4,
created_at -> Timestamp,
name -> Nullable<Text>,
avatar -> Nullable<Text>,
personal -> Bool,
slug -> Text,
}
teams (id) {
id -> Int4,
created_at -> Timestamp,
name -> Nullable<Text>,
avatar -> Nullable<Text>,
personal -> Bool,
slug -> Text,
}
}

table! {
tokens (token) {
token -> Text,
created_at -> Timestamp,
expires_at -> Timestamp,
user_id -> Int4,
}
tokens (token) {
token -> Text,
created_at -> Timestamp,
expires_at -> Timestamp,
user_id -> Int4,
}
}

table! {
users (id) {
id -> Int4,
created_at -> Timestamp,
slack_user_id -> Text,
name -> Text,
avatar -> Nullable<Text>,
}
users (id) {
id -> Int4,
created_at -> Timestamp,
slack_user_id -> Text,
name -> Text,
avatar -> Nullable<Text>,
}
}

table! {
whitelist (slack_user_id) {
slack_user_id -> Text,
}
whitelist (slack_user_id) {
slack_user_id -> Text,
}
}

joinable!(apps -> teams (team_id));
Expand All @@ -91,13 +91,13 @@ joinable!(team_users -> users (user_id));
joinable!(tokens -> users (user_id));

allow_tables_to_appear_in_same_query!(
apps,
domains,
oauth_apps,
oauth_device_requests,
team_users,
teams,
tokens,
users,
whitelist,
apps,
domains,
oauth_apps,
oauth_device_requests,
team_users,
teams,
tokens,
users,
whitelist,
);
30 changes: 15 additions & 15 deletions crates/db_models/src/team.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Queryable, Serialize, Identifiable)]
pub struct Team {
pub id: i32,
#[serde(skip_serializing)]
pub created_at: NaiveDateTime,
pub name: Option<String>,
pub avatar: Option<String>,
pub personal: bool,
pub slug: String,
pub id: i32,
#[serde(skip_serializing)]
pub created_at: NaiveDateTime,
pub name: Option<String>,
pub avatar: Option<String>,
pub personal: bool,
pub slug: String,
}

#[derive(Debug, Insertable, Deserialize)]
#[table_name = "teams"]
pub struct NewTeam {
pub name: Option<String>,
pub avatar: Option<String>,
#[serde(skip_deserializing)]
pub personal: bool,
pub slug: String,
pub name: Option<String>,
pub avatar: Option<String>,
#[serde(skip_deserializing)]
pub personal: bool,
pub slug: String,
}

#[derive(Debug, AsChangeset, Deserialize)]
#[table_name = "teams"]
pub struct UpdatedTeam {
pub name: Option<String>,
pub slug: Option<String>,
pub avatar: Option<String>,
pub name: Option<String>,
pub slug: Option<String>,
pub avatar: Option<String>,
}
4 changes: 2 additions & 2 deletions crates/db_models/src/team_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ use crate::{team::Team, user::User};
#[belongs_to(User)]
#[primary_key(team_id, user_id)]
pub struct TeamUser {
pub user_id: i32,
pub team_id: i32,
pub user_id: i32,
pub team_id: i32,
}
12 changes: 6 additions & 6 deletions crates/db_models/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ use chrono::NaiveDateTime;
#[table_name = "tokens"]
#[belongs_to(User)]
pub struct Token {
pub token: String,
pub created_at: NaiveDateTime,
pub expires_at: NaiveDateTime,
pub user_id: i32,
pub token: String,
pub created_at: NaiveDateTime,
pub expires_at: NaiveDateTime,
pub user_id: i32,
}

#[derive(Debug, Insertable)]
#[table_name = "tokens"]
pub struct NewToken<'a> {
pub token: &'a str,
pub user_id: i32,
pub token: &'a str,
pub user_id: i32,
}
18 changes: 9 additions & 9 deletions crates/db_models/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ use serde::Serialize;

#[derive(Debug, Queryable, Serialize, Identifiable)]
pub struct User {
pub id: i32,
#[serde(skip_serializing)]
pub created_at: NaiveDateTime,
pub slack_user_id: String,
pub name: String,
pub avatar: Option<String>,
pub id: i32,
#[serde(skip_serializing)]
pub created_at: NaiveDateTime,
pub slack_user_id: String,
pub name: String,
pub avatar: Option<String>,
}

#[derive(Debug, Insertable)]
#[table_name = "users"]
pub struct NewUser {
pub slack_user_id: String,
pub name: String,
pub avatar: Option<String>,
pub slack_user_id: String,
pub name: String,
pub avatar: Option<String>,
}
2 changes: 1 addition & 1 deletion crates/db_models/src/whitelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ use crate::schema::whitelist;
#[table_name = "whitelist"]
#[primary_key("slack_user_id")]
pub struct WhitelistEntry {
pub slack_user_id: String,
pub slack_user_id: String,
}
Loading

0 comments on commit d93b3f2

Please sign in to comment.