Upgrade and organize

This commit is contained in:
Adrian Woźniak 2023-03-31 23:25:20 +02:00
parent 427d386d39
commit cad12e7a76
373 changed files with 2758 additions and 3724 deletions

View File

@ -86,5 +86,5 @@ fabric.properties
/web/tmp/ /web/tmp/
/web/build/ /web/build/
/jirs-server/target/ /bitque-server/target/
/jirs-server/tmp/ /bitque-server/tmp/

4
.env
View File

@ -1,7 +1,7 @@
DEBUG=true DEBUG=true
RUST_LOG=debug RUST_LOG=debug
JIRS_CLIENT_PORT=80 JIRS_CLIENT_PORT=80
JIRS_CLIENT_BIND=jirs.lvh.me JIRS_CLIENT_BIND=bitque.lvh.me
DATABASE_URL=postgres://postgres@localhost:5432/jirs DATABASE_URL=postgres://postgres@localhost:5432/bitque
JIRS_SERVER_PORT=5000 JIRS_SERVER_PORT=5000
JIRS_SERVER_BIND=0.0.0.0 JIRS_SERVER_BIND=0.0.0.0

18
.gitignore vendored
View File

@ -12,16 +12,16 @@ highlight.toml
highlight.test.toml highlight.test.toml
pkg pkg
jirs-client/pkg bitque-client/pkg
jirs-client/tmp bitque-client/tmp
jirs-client/build bitque-client/build
tmp tmp
jirs-server/target bitque-server/target
jirs-cli/target bitque-cli/target
jirs-bat/bat bitque-bat/bat
highlight/jirs-highlight/build highlight/bitque-highlight/build
uploads uploads
config config
shared/jirs-config/target shared/bitque-config/target
jirs-client/src/location.rs bitque-client/src/location.rs

View File

@ -8,7 +8,7 @@ Use nothing other than standard rust tests.
## Submitting changes ## Submitting changes
Please send a [GitHub Pull Request to jirs](https://github.com/Eraden/hirs/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)). When you send a pull request, we will love you forever if you include RSpec examples. We can always use more test coverage. Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit). Please send a [GitHub Pull Request to bitque](https://github.com/Eraden/hirs/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)). When you send a pull request, we will love you forever if you include RSpec examples. We can always use more test coverage. Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).
Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this: Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:
@ -23,7 +23,7 @@ Start reading our code and you'll get the hang of it. We optimize for readabilit
* We ALWAYS run `cargo fmt` before commit * We ALWAYS run `cargo fmt` before commit
* We ALWAYS run `cargo clippy` before commit * We ALWAYS run `cargo clippy` before commit
* We avoid local variables and prefer functions in theirs place * We avoid local variables and prefer functions in theirs place
* We prefer rust over JavaScript * We prefer Rust over JavaScript
* We avoid putting logic in view * We avoid putting logic in view
* This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible. * This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.

3632
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,49 @@
#[package] #[package]
#name = "jirs" #name = "bitque"
#version = "0.1.0" #version = "0.1.0"
#authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] #authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
#edition = "2018" #edition = "2018"
#description = "JIRS (Simplified JIRA in Rust)" #description = "JIRS (Simplified JIRA in Rust)"
#repository = "https://gitlab.com/adrian.wozniak/jirs" #repository = "https://gitlab.com/adrian.wozniak/bitque"
#license = "MPL-2.0" #license = "MPL-2.0"
#license-file = "./LICENSE" #license-file = "./LICENSE"
[workspace] [workspace]
members = [ members = [
"./shared/common", "./crates/common",
"./jirs-cli", "./crates/bitque-cli",
"./jirs-server", "./crates/bitque-server",
"./shared/jirs-config", "./crates/bitque-config",
"./shared/jirs-data", "./crates/bitque-data",
"./derive/derive_enum_iter", "./crates/derive_enum_iter",
"./derive/derive_enum_primitive", "./crates/derive_enum_primitive",
"./derive/derive_enum_sql", "./crates/derive_enum_sql",
"./derive/derive_db_execute", "./crates/derive_db_execute",
"./actors/highlight-actor", "./crates/highlight-actor",
"./actors/database-actor", "./crates/database-actor",
"./actors/web-actor", "./crates/web-actor",
"./actors/websocket-actor", "./crates/websocket-actor",
"./actors/mail-actor", "./crates/mail-actor",
"./actors/amazon-actor", "./crates/amazon-actor",
"./actors/filesystem-actor", "./crates/filesystem-actor",
# Client # Client
"./web" "./crates/web"
] ]
[workspace.dependencies]
common = { path = "./crates/common" }
bitque-cli = { path = "./crates/bitque-cli" }
bitque-server = { path = "./crates/bitque-server" }
bitque-config = { path = "./crates/bitque-config" }
bitque-data = { path = "./crates/bitque-data" }
derive_enum_iter = { path = "./crates/derive_enum_iter" }
derive_enum_primitive = { path = "./crates/derive_enum_primitive" }
derive_enum_sql = { path = "./crates/derive_enum_sql" }
derive_db_execute = { path = "./crates/derive_db_execute" }
highlight-actor = { path = "./crates/highlight-actor" }
database-actor = { path = "./crates/database-actor" }
web-actor = { path = "./crates/web-actor" }
websocket-actor = { path = "./crates/websocket-actor" }
mail-actor = { path = "./crates/mail-actor" }
amazon-actor = { path = "./crates/amazon-actor" }
filesystem-actor = { path = "./crates/filesystem-actor" }

View File

@ -9,7 +9,7 @@ RUN . $HOME/.cargo/env && \
RUN ls -al /app RUN ls -al /app
CMD . $HOME/.cargo/env && \ CMD . $HOME/.cargo/env && \
cd ./jirs-server && \ cd ./bitque-server && \
rm -Rf ./target/debug/jirs_server && \ rm -Rf ./target/debug/bitque_server && \
cargo build --bin jirs_server --release --no-default-features --features local-storage && \ cargo build --bin bitque_server --release --no-default-features --features local-storage && \
cp /app/target/release/jirs_server /app/build/ cp /app/target/release/bitque_server /app/build/

View File

@ -1,13 +1,13 @@
# A simplified Jira clone built with seed.rs and actix # A simplified Jira clone built with seed.rs and actix
![JIRS](https://raw.githubusercontent.com/Eraden/jirs/master/web/static/project-icon.svg) ![JIRS](https://raw.githubusercontent.com/Eraden/bitque/master/web/static/project-icon.svg)
Server: [![builds.sr.ht status](https://builds.sr.ht/~tsumanu/jirs/server.yml.svg)](https://builds.sr.ht/~tsumanu/jirs/server.yml?) Server: [![builds.sr.ht status](https://builds.sr.ht/~tsumanu/bitque/server.yml.svg)](https://builds.sr.ht/~tsumanu/bitque/server.yml?)
Client: [![builds.sr.ht status](https://builds.sr.ht/~tsumanu/jirs/client.yml.svg)](https://builds.sr.ht/~tsumanu/jirs/client.yml?) Client: [![builds.sr.ht status](https://builds.sr.ht/~tsumanu/bitque/client.yml.svg)](https://builds.sr.ht/~tsumanu/bitque/client.yml?)
Main repo: https://git.sr.ht/~tsumanu/jirs Main repo: https://git.sr.ht/~tsumanu/bitque
Demo: https://jirs.ita-prog.pl Demo: https://bitque.ita-prog.pl
## Features ## Features
@ -101,7 +101,7 @@ This requires additional configuration.
```toml ```toml
[filesystem] [filesystem]
store_path = "/var/jirs/uploads" store_path = "/var/bitque/uploads"
client_path = "/img" client_path = "/img"
``` ```
@ -128,7 +128,7 @@ region_name = "eu-central-1"
```toml ```toml
# db.toml # db.toml
concurrency = 2 concurrency = 2
database_url = "postgres://postgres@localhost:5432/jirs" database_url = "postgres://postgres@localhost:5432/bitque"
``` ```
#### Mail Service #### Mail Service
@ -141,15 +141,15 @@ concurrency = 2
user = "apikey" user = "apikey"
pass = "YOUR-TOKEN" pass = "YOUR-TOKEN"
host = "smtp.sendgrid.net" host = "smtp.sendgrid.net"
from = "contact@jirs.pl" from = "contact@bitque.pl"
``` ```
### Local variables ### Local variables
Within `jirs` directory place `.env` file with following content Within `bitque` directory place `.env` file with following content
```dotenv ```dotenv
DATABASE_URL=postgres://postgres@localhost:5432/jirs DATABASE_URL=postgres://postgres@localhost:5432/bitque
RUST_LOG=actix_web=info,diesel=info RUST_LOG=actix_web=info,diesel=info
JIRS_CLIENT_PORT=7000 JIRS_CLIENT_PORT=7000
JIRS_CLIENT_BIND=0.0.0.0 JIRS_CLIENT_BIND=0.0.0.0
@ -170,23 +170,23 @@ Requirements:
```bash ```bash
cargo install diesel_cli --no-default-features --features postgres cargo install diesel_cli --no-default-features --features postgres
export DATABASE_URL=postgres://postgres@localhost/jirs export DATABASE_URL=postgres://postgres@localhost/bitque
diesel setup diesel setup
diesel migration run diesel migration run
cargo run --bin jirs_server cargo run --bin bitque_server
``` ```
### Frontend ### Frontend
```bash ```bash
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
cd jirs_client cd bitque_client
./web/scripts/prod.sh ./web/scripts/prod.sh
``` ```
```bash ```bash
sudo ln -s ./jirs.nginx /etc/nginx/sites-enabled/ sudo ln -s ./bitque.nginx /etc/nginx/sites-enabled/
sudo nginx -s reload sudo nginx -s reload
``` ```
@ -204,10 +204,10 @@ Custom element glued with WASM
* `lang` does not have callback and it's used only on `connectedCallback` * `lang` does not have callback and it's used only on `connectedCallback`
```html ```html
<jirs-code-view lang="Rust" file-path="/some/path.rs"> <bitque-code-view lang="Rust" file-path="/some/path.rs">
struct Foo { struct Foo {
} }
</jirs-code-view> </bitque-code-view>
``` ```
### Supported languages ### Supported languages
@ -349,3 +349,11 @@ struct Foo {
* lrc * lrc
* reStructuredText * reStructuredText
* srt * srt
## Utils
```bash
cargo install --locked --git https://github.com/dcchut/cargo-derivefmt --bin cargo-derivefmt
cargo install carto-sort
cargo install cargo-llvm-cov
```

View File

@ -1,44 +0,0 @@
[package]
name = "amazon-actor"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs"
license = "MPL-2.0"
#license-file = "../LICENSE"
[lib]
name = "amazon_actor"
path = "./src/lib.rs"
[dependencies]
common = { path = "../../shared/common" }
actix = { version = "0.10.0" }
bytes = { version = "1.0.0" }
serde = { version = "*" }
futures = { version = "0.3.8" }
openssl-sys = { version = "*", features = ["vendored"] }
libc = { version = "0.2.0", default-features = false }
uuid = { version = "0.8.2", features = ["serde", "v4", "v5"] }
[dependencies.jirs-config]
path = "../../shared/jirs-config"
features = ["mail", "web", "local-storage"]
# Amazon S3
[dependencies.rusoto_s3]
version = "0.47.0"
[dependencies.rusoto_core]
version = "0.47.0"
[dependencies.rusoto_signature]
version = "0.47.0"
[dependencies.tokio]
version = "0.2.23"
features = ["tcp", "time", "rt-core", "fs"]

View File

@ -1,730 +0,0 @@
#![allow(unused_imports, dead_code)]
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `comments` table.
///
/// (Automatically generated by Diesel.)
comments (id) {
/// The `id` column of the `comments` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `body` column of the `comments` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
body -> Text,
/// The `user_id` column of the `comments` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
user_id -> Int4,
/// The `issue_id` column of the `comments` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
issue_id -> Int4,
/// The `created_at` column of the `comments` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `comments` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `epics` table.
///
/// (Automatically generated by Diesel.)
epics (id) {
/// The `id` column of the `epics` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `name` column of the `epics` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
name -> Text,
/// The `user_id` column of the `epics` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
user_id -> Int4,
/// The `project_id` column of the `epics` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
project_id -> Int4,
/// The `created_at` column of the `epics` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `epics` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
/// The `starts_at` column of the `epics` table.
///
/// Its SQL type is `Nullable<Timestamp>`.
///
/// (Automatically generated by Diesel.)
starts_at -> Nullable<Timestamp>,
/// The `ends_at` column of the `epics` table.
///
/// Its SQL type is `Nullable<Timestamp>`.
///
/// (Automatically generated by Diesel.)
ends_at -> Nullable<Timestamp>,
/// The `description` column of the `epics` table.
///
/// Its SQL type is `Nullable<Text>`.
///
/// (Automatically generated by Diesel.)
description -> Nullable<Text>,
/// The `description_html` column of the `epics` table.
///
/// Its SQL type is `Nullable<Text>`.
///
/// (Automatically generated by Diesel.)
description_html -> Nullable<Text>,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `invitations` table.
///
/// (Automatically generated by Diesel.)
invitations (id) {
/// The `id` column of the `invitations` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `name` column of the `invitations` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
name -> Text,
/// The `email` column of the `invitations` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
email -> Text,
/// The `state` column of the `invitations` table.
///
/// Its SQL type is `InvitationStateType`.
///
/// (Automatically generated by Diesel.)
state -> InvitationStateType,
/// The `project_id` column of the `invitations` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
project_id -> Int4,
/// The `invited_by_id` column of the `invitations` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
invited_by_id -> Int4,
/// The `created_at` column of the `invitations` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `invitations` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
/// The `bind_token` column of the `invitations` table.
///
/// Its SQL type is `Uuid`.
///
/// (Automatically generated by Diesel.)
bind_token -> Uuid,
/// The `role` column of the `invitations` table.
///
/// Its SQL type is `UserRoleType`.
///
/// (Automatically generated by Diesel.)
role -> UserRoleType,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `issue_assignees` table.
///
/// (Automatically generated by Diesel.)
issue_assignees (id) {
/// The `id` column of the `issue_assignees` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `issue_id` column of the `issue_assignees` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
issue_id -> Int4,
/// The `user_id` column of the `issue_assignees` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
user_id -> Int4,
/// The `created_at` column of the `issue_assignees` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `issue_assignees` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `issue_statuses` table.
///
/// (Automatically generated by Diesel.)
issue_statuses (id) {
/// The `id` column of the `issue_statuses` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `name` column of the `issue_statuses` table.
///
/// Its SQL type is `Varchar`.
///
/// (Automatically generated by Diesel.)
name -> Varchar,
/// The `position` column of the `issue_statuses` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
position -> Int4,
/// The `project_id` column of the `issue_statuses` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
project_id -> Int4,
/// The `created_at` column of the `issue_statuses` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `issue_statuses` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `issues` table.
///
/// (Automatically generated by Diesel.)
issues (id) {
/// The `id` column of the `issues` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `title` column of the `issues` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
title -> Text,
/// The `issue_type` column of the `issues` table.
///
/// Its SQL type is `IssueTypeType`.
///
/// (Automatically generated by Diesel.)
issue_type -> IssueTypeType,
/// The `priority` column of the `issues` table.
///
/// Its SQL type is `IssuePriorityType`.
///
/// (Automatically generated by Diesel.)
priority -> IssuePriorityType,
/// The `list_position` column of the `issues` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
list_position -> Int4,
/// The `description` column of the `issues` table.
///
/// Its SQL type is `Nullable<Text>`.
///
/// (Automatically generated by Diesel.)
description -> Nullable<Text>,
/// The `description_text` column of the `issues` table.
///
/// Its SQL type is `Nullable<Text>`.
///
/// (Automatically generated by Diesel.)
description_text -> Nullable<Text>,
/// The `estimate` column of the `issues` table.
///
/// Its SQL type is `Nullable<Int4>`.
///
/// (Automatically generated by Diesel.)
estimate -> Nullable<Int4>,
/// The `time_spent` column of the `issues` table.
///
/// Its SQL type is `Nullable<Int4>`.
///
/// (Automatically generated by Diesel.)
time_spent -> Nullable<Int4>,
/// The `time_remaining` column of the `issues` table.
///
/// Its SQL type is `Nullable<Int4>`.
///
/// (Automatically generated by Diesel.)
time_remaining -> Nullable<Int4>,
/// The `reporter_id` column of the `issues` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
reporter_id -> Int4,
/// The `project_id` column of the `issues` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
project_id -> Int4,
/// The `created_at` column of the `issues` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `issues` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
/// The `issue_status_id` column of the `issues` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
issue_status_id -> Int4,
/// The `epic_id` column of the `issues` table.
///
/// Its SQL type is `Nullable<Int4>`.
///
/// (Automatically generated by Diesel.)
epic_id -> Nullable<Int4>,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `messages` table.
///
/// (Automatically generated by Diesel.)
messages (id) {
/// The `id` column of the `messages` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `receiver_id` column of the `messages` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
receiver_id -> Int4,
/// The `sender_id` column of the `messages` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
sender_id -> Int4,
/// The `summary` column of the `messages` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
summary -> Text,
/// The `description` column of the `messages` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
description -> Text,
/// The `message_type` column of the `messages` table.
///
/// Its SQL type is `MessageTypeType`.
///
/// (Automatically generated by Diesel.)
message_type -> MessageTypeType,
/// The `hyper_link` column of the `messages` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
hyper_link -> Text,
/// The `created_at` column of the `messages` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `messages` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `projects` table.
///
/// (Automatically generated by Diesel.)
projects (id) {
/// The `id` column of the `projects` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `name` column of the `projects` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
name -> Text,
/// The `url` column of the `projects` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
url -> Text,
/// The `description` column of the `projects` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
description -> Text,
/// The `category` column of the `projects` table.
///
/// Its SQL type is `ProjectCategoryType`.
///
/// (Automatically generated by Diesel.)
category -> ProjectCategoryType,
/// The `created_at` column of the `projects` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `projects` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
/// The `time_tracking` column of the `projects` table.
///
/// Its SQL type is `TimeTrackingType`.
///
/// (Automatically generated by Diesel.)
time_tracking -> TimeTrackingType,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `tokens` table.
///
/// (Automatically generated by Diesel.)
tokens (id) {
/// The `id` column of the `tokens` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `user_id` column of the `tokens` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
user_id -> Int4,
/// The `access_token` column of the `tokens` table.
///
/// Its SQL type is `Uuid`.
///
/// (Automatically generated by Diesel.)
access_token -> Uuid,
/// The `refresh_token` column of the `tokens` table.
///
/// Its SQL type is `Uuid`.
///
/// (Automatically generated by Diesel.)
refresh_token -> Uuid,
/// The `created_at` column of the `tokens` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `tokens` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
/// The `bind_token` column of the `tokens` table.
///
/// Its SQL type is `Nullable<Uuid>`.
///
/// (Automatically generated by Diesel.)
bind_token -> Nullable<Uuid>,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `user_projects` table.
///
/// (Automatically generated by Diesel.)
user_projects (id) {
/// The `id` column of the `user_projects` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `user_id` column of the `user_projects` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
user_id -> Int4,
/// The `project_id` column of the `user_projects` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
project_id -> Int4,
/// The `is_default` column of the `user_projects` table.
///
/// Its SQL type is `Bool`.
///
/// (Automatically generated by Diesel.)
is_default -> Bool,
/// The `is_current` column of the `user_projects` table.
///
/// Its SQL type is `Bool`.
///
/// (Automatically generated by Diesel.)
is_current -> Bool,
/// The `role` column of the `user_projects` table.
///
/// Its SQL type is `UserRoleType`.
///
/// (Automatically generated by Diesel.)
role -> UserRoleType,
/// The `created_at` column of the `user_projects` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `user_projects` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `user_settings` table.
///
/// (Automatically generated by Diesel.)
user_settings (id) {
/// The `id` column of the `user_settings` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `user_id` column of the `user_settings` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
user_id -> Int4,
/// The `text_editor_mode` column of the `user_settings` table.
///
/// Its SQL type is `TextEditorModeType`.
///
/// (Automatically generated by Diesel.)
text_editor_mode -> TextEditorModeType,
}
}
table! {
use diesel::sql_types::*;
use jirs_data::*;
/// Representation of the `users` table.
///
/// (Automatically generated by Diesel.)
users (id) {
/// The `id` column of the `users` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
id -> Int4,
/// The `name` column of the `users` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
name -> Text,
/// The `email` column of the `users` table.
///
/// Its SQL type is `Text`.
///
/// (Automatically generated by Diesel.)
email -> Text,
/// The `avatar_url` column of the `users` table.
///
/// Its SQL type is `Nullable<Text>`.
///
/// (Automatically generated by Diesel.)
avatar_url -> Nullable<Text>,
/// The `created_at` column of the `users` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `updated_at` column of the `users` table.
///
/// Its SQL type is `Timestamp`.
///
/// (Automatically generated by Diesel.)
updated_at -> Timestamp,
}
}
joinable!(comments -> issues (issue_id));
joinable!(comments -> users (user_id));
joinable!(epics -> projects (project_id));
joinable!(epics -> users (user_id));
joinable!(invitations -> projects (project_id));
joinable!(invitations -> users (invited_by_id));
joinable!(issue_assignees -> issues (issue_id));
joinable!(issue_assignees -> users (user_id));
joinable!(issue_statuses -> projects (project_id));
joinable!(issues -> epics (epic_id));
joinable!(issues -> issue_statuses (issue_status_id));
joinable!(issues -> projects (project_id));
joinable!(issues -> users (reporter_id));
joinable!(tokens -> users (user_id));
joinable!(user_projects -> projects (project_id));
joinable!(user_projects -> users (user_id));
joinable!(user_settings -> users (user_id));
allow_tables_to_appear_in_same_query!(
comments,
epics,
invitations,
issue_assignees,
issue_statuses,
issues,
messages,
projects,
tokens,
user_projects,
user_settings,
users,
);

View File

@ -1,63 +0,0 @@
[package]
name = "web-actor"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs"
license = "MPL-2.0"
#license-file = "../LICENSE"
[lib]
name = "web_actor"
path = "./src/lib.rs"
[features]
local-storage = ["filesystem-actor"]
aws-s3 = ["amazon-actor"]
default = ["local-storage"]
[dependencies]
common = { path = "../../shared/common" }
actix = { version = "0.10.0" }
serde = "*"
bincode = "*"
toml = { version = "*" }
actix-multipart = "*"
futures = { version = "0.3.8" }
openssl-sys = { version = "*", features = ["vendored"] }
libc = { version = "0.2.0", default-features = false }
uuid = { version = "0.8.2", features = ["serde", "v4", "v5"] }
[dependencies.jirs-config]
path = "../../shared/jirs-config"
features = ["mail", "web", "local-storage"]
[dependencies.jirs-data]
path = "../../shared/jirs-data"
features = ["backend"]
[dependencies.database-actor]
path = "../database-actor"
[dependencies.mail-actor]
path = "../mail-actor"
[dependencies.websocket-actor]
path = "../websocket-actor"
[dependencies.filesystem-actor]
path = "../filesystem-actor"
optional = true
[dependencies.amazon-actor]
path = "../amazon-actor"
optional = true
[dependencies.tokio]
version = "0.2.23"
features = ["dns"]

View File

@ -0,0 +1,28 @@
[package]
name = "amazon-actor"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0"
#license-file = "../LICENSE"
[lib]
name = "amazon_actor"
path = "./src/lib.rs"
[dependencies]
actix = { version = "0.13.0" }
bitque-config = { workspace = true, features = ["mail", "web", "local-storage"] }
bytes = { version = "1.0.0" }
common = { workspace = true }
futures = { version = "0.3.8" }
libc = { version = "0.2.0", default-features = false }
openssl-sys = { version = "*", features = ["vendored"] }
rusoto_core = { version = "0.48.0" }
rusoto_s3 = { version = "0.48.0" }
rusoto_signature = { version = "0.48.0" }
serde = { version = "*" }
tokio = { version = "1", features = ["full"] }
uuid = { version = "1.3.0", features = ["serde", "v4", "v5"] }

View File

@ -34,13 +34,13 @@ impl actix::Handler<S3PutObject> for AmazonExecutor {
mut source, mut source,
file_name, file_name,
} = msg; } = msg;
jirs_config::amazon::config().set_variables(); bitque_config::amazon::config().set_variables();
tokio::runtime::Runtime::new() tokio::runtime::Runtime::new()
.expect("Failed to start amazon agent") .expect("Failed to start amazon agent")
.block_on(async { .block_on(async {
let s3 = jirs_config::amazon::config(); let s3 = bitque_config::amazon::config();
common::log::debug!("{:?}", s3); ::tracing::debug!("{:?}", s3);
// TODO: Unable to upload as stream because there is no size_hint // TODO: Unable to upload as stream because there is no size_hint
// let stream = source // let stream = source
@ -67,18 +67,18 @@ impl actix::Handler<S3PutObject> for AmazonExecutor {
let id = match client.put_object(put_object).await { let id = match client.put_object(put_object).await {
Ok(obj) => obj, Ok(obj) => obj,
Err(e) => { Err(e) => {
common::log::error!("{}", e); ::tracing::error!("{}", e);
return Err(AmazonError::UploadFailed); return Err(AmazonError::UploadFailed);
} }
}; };
common::log::debug!("{:?}", id); ::tracing::debug!("{:?}", id);
Ok(aws_s3_url(file_name.as_str())) Ok(aws_s3_url(file_name.as_str()))
}) })
} }
} }
fn aws_s3_url(key: &str) -> String { fn aws_s3_url(key: &str) -> String {
let config = jirs_config::amazon::config(); let config = bitque_config::amazon::config();
format!( format!(
"https://{bucket}.s3.{region}.amazonaws.com/{key}", "https://{bucket}.s3.{region}.amazonaws.com/{key}",
bucket = config.bucket, bucket = config.bucket,

View File

@ -0,0 +1,12 @@
[package]
name = "bitquec"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
[dependencies]
actix = { version = "0.13.0" }
clap = { version = "4.1.13" }
common = { workspace = true }
termion = { version = "*" }
tui = { version = "0.19.0", features = ["termion"] }

View File

@ -14,7 +14,7 @@ use tui::style::{Color, Style};
use tui::widgets::{Block, Borders, Tabs}; use tui::widgets::{Block, Borders, Tabs};
use tui::Terminal; use tui::Terminal;
#[derive(Debug, Clone, Copy)] #[derive(Clone, Copy, Debug)]
pub struct Config { pub struct Config {
pub exit_key: Key, pub exit_key: Key,
pub tick_rate: Duration, pub tick_rate: Duration,

View File

@ -1,15 +1,15 @@
[package] [package]
name = "jirs-config" name = "bitque-config"
version = "0.1.0" version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"
[lib] [lib]
name = "jirs_config" name = "bitque_config"
path = "./src/lib.rs" path = "./src/lib.rs"
[features] [features]
@ -23,18 +23,8 @@ websocket = []
default = ["local-storage", "database", "hi", "mail", "web", "websocket"] default = ["local-storage", "database", "hi", "mail", "web", "websocket"]
[dependencies] [dependencies]
rusoto_core = { optional = true, version = "0.48.0" }
rusoto_s3 = { optional = true, version = "0.48.0" }
rusoto_signature = { optional = true, version = "0.48.0" }
serde = { version = "*" } serde = { version = "*" }
toml = { version = "*" } toml = { version = "*" }
# Amazon S3
[dependencies.rusoto_s3]
optional = true
version = "0.47.0"
[dependencies.rusoto_core]
optional = true
version = "0.47.0"
[dependencies.rusoto_signature]
optional = true
version = "0.47.0"

View File

@ -1,7 +1,7 @@
use rusoto_signature::Region; use rusoto_signature::Region;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)] #[derive(Debug, Deserialize, Serialize)]
pub struct Configuration { pub struct Configuration {
pub access_key_id: String, pub access_key_id: String,
pub secret_access_key: String, pub secret_access_key: String,

View File

@ -1,4 +1,4 @@
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde::Deserialize, serde::Serialize)]
pub struct Configuration { pub struct Configuration {
pub concurrency: usize, pub concurrency: usize,
pub database_url: String, pub database_url: String,
@ -7,10 +7,10 @@ pub struct Configuration {
impl Default for Configuration { impl Default for Configuration {
fn default() -> Self { fn default() -> Self {
let database_url = if cfg!(test) { let database_url = if cfg!(test) {
"postgres://postgres@localhost:5432/jirs_test".to_string() "postgres://postgres@localhost:5432/bitque_test".to_string()
} else { } else {
std::env::var("DATABASE_URL") std::env::var("DATABASE_URL")
.unwrap_or_else(|_| "postgres://postgres@localhost:5432/jirs".to_string()) .unwrap_or_else(|_| "postgres://postgres@localhost:5432/bitque".to_string())
}; };
Self { Self {
concurrency: 2, concurrency: 2,

View File

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)] #[derive(Deserialize, Serialize)]
pub struct Configuration { pub struct Configuration {
pub store_path: String, pub store_path: String,
pub client_path: String, pub client_path: String,

View File

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)] #[derive(Deserialize, Serialize)]
pub struct Configuration { pub struct Configuration {
pub concurrency: usize, pub concurrency: usize,
#[serde(default = "Configuration::default_theme")] #[serde(default = "Configuration::default_theme")]

View File

@ -1,4 +1,4 @@
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde::Deserialize, serde::Serialize)]
pub struct Configuration { pub struct Configuration {
pub concurrency: usize, pub concurrency: usize,
pub user: String, pub user: String,
@ -14,7 +14,7 @@ impl Default for Configuration {
user: "apikey".to_string(), user: "apikey".to_string(),
pass: "YOUR-TOKEN".to_string(), pass: "YOUR-TOKEN".to_string(),
host: "smtp.sendgrid.net".to_string(), host: "smtp.sendgrid.net".to_string(),
from: "contact@jirs.pl".to_string(), from: "contact@bitque.pl".to_string(),
} }
} }
} }

View File

@ -6,7 +6,7 @@ pub enum Protocol {
Https, Https,
} }
#[derive(Serialize, Deserialize)] #[derive(Deserialize, Serialize)]
pub struct Configuration { pub struct Configuration {
pub concurrency: usize, pub concurrency: usize,
pub port: String, pub port: String,

View File

@ -1,4 +1,4 @@
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde::Deserialize, serde::Serialize)]
pub struct Configuration { pub struct Configuration {
pub concurrency: usize, pub concurrency: usize,
} }

View File

@ -0,0 +1,29 @@
[package]
name = "bitque-data"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0"
#license-file = "../LICENSE"
[lib]
name = "bitque_data"
path = "./src/lib.rs"
[features]
backend = ["diesel", "actix", "diesel-derive-newtype"]
frontend = []
[dependencies]
actix = { version = "0.13.0", optional = true }
chrono = { version = "*", features = ["serde"] }
diesel = { version = "2.0.3", features = ["postgres", "numeric", "uuid", "r2d2"], optional = true }
diesel-derive-enum = { version = "2.0.1", features = ["postgres"] }
diesel-derive-more = { version = "1.1.3" }
diesel-derive-newtype = { version = "2.0.0-rc.0", optional = true }
serde = { version = "*" }
serde_json = { version = "*" }
strum = { version = "0.24.1", features = ['derive', 'strum_macros', 'std'] }
uuid = { version = "1.3.0", features = ["serde"] }

View File

@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum ProjectFieldId { pub enum ProjectFieldId {
Name, Name,
Url, Url,
@ -11,20 +11,20 @@ pub enum ProjectFieldId {
IssueStatusName, IssueStatusName,
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum SignInFieldId { pub enum SignInFieldId {
Username, Username,
Email, Email,
Token, Token,
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum SignUpFieldId { pub enum SignUpFieldId {
Username, Username,
Email, Email,
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum UsersFieldId { pub enum UsersFieldId {
Username, Username,
Email, Email,
@ -34,17 +34,17 @@ pub enum UsersFieldId {
TextEditorMode, TextEditorMode,
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum InviteFieldId { pub enum InviteFieldId {
Token, Token,
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum CommentFieldId { pub enum CommentFieldId {
Body, Body,
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum IssueFieldId { pub enum IssueFieldId {
Type, Type,
Title, Title,
@ -62,7 +62,7 @@ pub enum IssueFieldId {
EpicEndsAt, EpicEndsAt,
} }
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialOrd, PartialEq, Hash)] #[derive(Clone, Copy, Debug, Deserialize, Hash, PartialEq, PartialOrd, Serialize)]
pub enum EpicFieldId { pub enum EpicFieldId {
Name, Name,
StartsAt, StartsAt,

View File

@ -1,11 +1,8 @@
use std::cmp::Ordering; use std::cmp::Ordering;
use std::str::FromStr;
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use derive_enum_iter::EnumIter;
use derive_enum_primitive::EnumPrimitive;
#[cfg(feature = "backend")] #[cfg(feature = "backend")]
use derive_enum_sql::EnumSql; use diesel_derive_enum::DbEnum;
#[cfg(feature = "backend")] #[cfg(feature = "backend")]
use diesel::*; use diesel::*;
pub use fields::*; pub use fields::*;
@ -13,6 +10,7 @@ pub use msg::WsMsg;
pub use payloads::*; pub use payloads::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use uuid::Uuid; use uuid::Uuid;
use strum::*;
pub mod fields; pub mod fields;
pub mod msg; pub mod msg;
@ -52,11 +50,11 @@ pub type InvitationToken = Uuid;
pub type StartsAt = NaiveDateTime; pub type StartsAt = NaiveDateTime;
pub type EndsAt = NaiveDateTime; pub type EndsAt = NaiveDateTime;
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))] #[cfg_attr(feature = "backend", derive(DbEnum))]
#[cfg_attr(feature = "backend", sql_type = "IssueTypeType")]
#[derive( #[derive(
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive, Clone, Copy, Debug, Deserialize, Display, EnumIter, EnumString, Hash, IntoStaticStr, PartialEq, PartialOrd, Serialize,
)] )]
#[strum(serialize_all = "snake_case")]
pub enum IssueType { pub enum IssueType {
Task, Task,
Bug, Bug,
@ -69,17 +67,11 @@ impl Default for IssueType {
} }
} }
impl std::fmt::Display for IssueType { #[cfg_attr(feature = "backend", derive(DbEnum))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.to_str())
}
}
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
#[cfg_attr(feature = "backend", sql_type = "IssuePriorityType")]
#[derive( #[derive(
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive, Clone, Copy, Debug, Deserialize, Display, EnumIter, EnumString, Hash, IntoStaticStr, PartialEq, PartialOrd, Serialize,
)] )]
#[strum(serialize_all = "snake_case")]
pub enum IssuePriority { pub enum IssuePriority {
Highest, Highest,
High, High,
@ -94,15 +86,9 @@ impl Default for IssuePriority {
} }
} }
impl std::fmt::Display for IssuePriority { #[cfg_attr(feature = "backend", derive(DbEnum))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { #[derive(Clone, Copy, Debug, Deserialize, Display, EnumIter, EnumString, Hash, IntoStaticStr, PartialEq, Serialize)]
f.write_str(self.to_str()) #[strum(serialize_all = "snake_case")]
}
}
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
#[cfg_attr(feature = "backend", sql_type = "UserRoleType")]
#[derive(Clone, Copy, Deserialize, Serialize, Debug, PartialEq, Hash, EnumIter, EnumPrimitive)]
pub enum UserRole { pub enum UserRole {
User, User,
Manager, Manager,
@ -130,17 +116,11 @@ impl Default for UserRole {
} }
} }
impl std::fmt::Display for UserRole { #[cfg_attr(feature = "backend", derive(DbEnum))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.to_str())
}
}
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
#[cfg_attr(feature = "backend", sql_type = "ProjectCategoryType")]
#[derive( #[derive(
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive, Clone, Copy, Debug, Deserialize, Display, EnumIter, EnumString, Hash, IntoStaticStr, PartialEq, PartialOrd, Serialize,
)] )]
#[strum(serialize_all = "snake_case")]
pub enum ProjectCategory { pub enum ProjectCategory {
Software, Software,
Marketing, Marketing,
@ -153,17 +133,11 @@ impl Default for ProjectCategory {
} }
} }
impl std::fmt::Display for ProjectCategory { #[cfg_attr(feature = "backend", derive(DbEnum))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.to_str())
}
}
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
#[cfg_attr(feature = "backend", sql_type = "InvitationStateType")]
#[derive( #[derive(
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive, Clone, Copy, Debug, Deserialize, Display, EnumIter, EnumString, Hash, IntoStaticStr, PartialEq, PartialOrd, Serialize,
)] )]
#[strum(serialize_all = "snake_case")]
pub enum InvitationState { pub enum InvitationState {
Sent, Sent,
Accepted, Accepted,
@ -176,17 +150,11 @@ impl Default for InvitationState {
} }
} }
impl std::fmt::Display for InvitationState { #[cfg_attr(feature = "backend", derive(DbEnum))]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.to_str())
}
}
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))]
#[cfg_attr(feature = "backend", sql_type = "TimeTrackingType")]
#[derive( #[derive(
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive, Clone, Copy, Debug, Deserialize, Display, EnumIter, EnumString, Hash, IntoStaticStr, PartialEq, PartialOrd, Serialize,
)] )]
#[strum(serialize_all = "snake_case")]
pub enum TimeTracking { pub enum TimeTracking {
Untracked, Untracked,
Fibonacci, Fibonacci,
@ -199,7 +167,7 @@ impl Default for TimeTracking {
} }
} }
#[derive(Clone, Serialize, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq, Serialize)]
pub struct ErrorResponse { pub struct ErrorResponse {
pub errors: Vec<String>, pub errors: Vec<String>,
} }
@ -213,7 +181,7 @@ impl ErrorResponse {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Project { pub struct Project {
pub id: ProjectId, pub id: ProjectId,
pub name: String, pub name: String,
@ -231,7 +199,7 @@ impl Project {
} }
} }
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Issue { pub struct Issue {
pub id: EpicId, pub id: EpicId,
pub title: String, pub title: String,
@ -254,7 +222,7 @@ pub struct Issue {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct IssueStatus { pub struct IssueStatus {
pub id: IssueStatusId, pub id: IssueStatusId,
pub name: String, pub name: String,
@ -265,7 +233,7 @@ pub struct IssueStatus {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Invitation { pub struct Invitation {
pub id: InvitationId, pub id: InvitationId,
pub name: String, pub name: String,
@ -280,7 +248,7 @@ pub struct Invitation {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Comment { pub struct Comment {
pub id: CommentId, pub id: CommentId,
pub body: String, pub body: String,
@ -291,7 +259,7 @@ pub struct Comment {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct User { pub struct User {
pub id: UserId, pub id: UserId,
pub name: String, pub name: String,
@ -308,7 +276,7 @@ impl User {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct UserProject { pub struct UserProject {
pub id: UserProjectId, pub id: UserProjectId,
pub user_id: UserId, pub user_id: UserId,
@ -321,7 +289,7 @@ pub struct UserProject {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Token { pub struct Token {
pub id: TokenId, pub id: TokenId,
pub user_id: UserId, pub user_id: UserId,
@ -333,7 +301,7 @@ pub struct Token {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct IssueAssignee { pub struct IssueAssignee {
pub id: i32, pub id: i32,
pub issue_id: EpicId, pub issue_id: EpicId,
@ -342,11 +310,11 @@ pub struct IssueAssignee {
pub updated_at: NaiveDateTime, pub updated_at: NaiveDateTime,
} }
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))] #[cfg_attr(feature = "backend", derive(DbEnum))]
#[cfg_attr(feature = "backend", sql_type = "MessageTypeType")]
#[derive( #[derive(
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumPrimitive, Clone, Copy, Debug, Deserialize, Display, EnumString, Hash, IntoStaticStr, PartialEq, PartialOrd, Serialize,
)] )]
#[strum(serialize_all = "snake_case")]
pub enum MessageType { pub enum MessageType {
ReceivedInvitation, ReceivedInvitation,
AssignedToIssue, AssignedToIssue,
@ -359,14 +327,8 @@ impl Default for MessageType {
} }
} }
impl std::fmt::Display for MessageType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.to_label())
}
}
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Message { pub struct Message {
pub id: MessageId, pub id: MessageId,
pub receiver_id: UserId, pub receiver_id: UserId,
@ -380,7 +342,7 @@ pub struct Message {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Epic { pub struct Epic {
pub id: EpicId, pub id: EpicId,
pub name: NameString, pub name: NameString,
@ -400,7 +362,7 @@ pub static BOLD: FontStyle = 1;
pub static UNDERLINE: FontStyle = 2; pub static UNDERLINE: FontStyle = 2;
pub static ITALIC: FontStyle = 4; pub static ITALIC: FontStyle = 4;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Color { pub struct Color {
/// Red component /// Red component
pub r: u8, pub r: u8,
@ -412,7 +374,7 @@ pub struct Color {
pub a: u8, pub a: u8,
} }
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Style { pub struct Style {
/// Foreground color /// Foreground color
pub foreground: Color, pub foreground: Color,
@ -422,16 +384,16 @@ pub struct Style {
pub font_style: FontStyle, pub font_style: FontStyle,
} }
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct HighlightedCode { pub struct HighlightedCode {
pub parts: Vec<(Style, String)>, pub parts: Vec<(Style, String)>,
} }
#[cfg_attr(feature = "backend", derive(FromSqlRow, AsExpression, EnumSql))] #[cfg_attr(feature = "backend", derive(DbEnum))]
#[cfg_attr(feature = "backend", sql_type = "TextEditorModeType")]
#[derive( #[derive(
Clone, Copy, Deserialize, Serialize, Debug, PartialOrd, PartialEq, Hash, EnumIter, EnumPrimitive, Clone, Copy, Debug, Deserialize, Display, EnumIter, EnumString, Hash, IntoStaticStr, PartialEq, PartialOrd, Serialize,
)] )]
#[strum(serialize_all = "snake_case")]
#[repr(C)] #[repr(C)]
pub enum TextEditorMode { pub enum TextEditorMode {
MdOnly, MdOnly,
@ -446,7 +408,7 @@ impl Default for TextEditorMode {
} }
#[cfg_attr(feature = "backend", derive(Queryable))] #[cfg_attr(feature = "backend", derive(Queryable))]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct UserSetting { pub struct UserSetting {
pub id: UserSettingId, pub id: UserSettingId,
pub user_id: UserId, pub user_id: UserId,

View File

@ -11,7 +11,7 @@ use crate::{
UsernameString, UsernameString,
}; };
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[repr(C)] #[repr(C)]
pub enum WsError { pub enum WsError {
InvalidLoginPair, InvalidLoginPair,
@ -119,7 +119,7 @@ impl WsError {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct IssueSync { pub struct IssueSync {
pub id: IssueId, pub id: IssueId,
pub list_position: ListPosition, pub list_position: ListPosition,
@ -127,7 +127,7 @@ pub struct IssueSync {
pub epic_id: Option<IssueId>, pub epic_id: Option<IssueId>,
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgIssue { pub enum WsMsgIssue {
IssueUpdate(IssueId, IssueFieldId, PayloadVariant), IssueUpdate(IssueId, IssueFieldId, PayloadVariant),
IssueUpdated(Issue), IssueUpdated(Issue),
@ -145,7 +145,7 @@ impl From<WsMsgIssue> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgIssueStatus { pub enum WsMsgIssueStatus {
IssueStatusesLoad, IssueStatusesLoad,
IssueStatusesLoaded(Vec<IssueStatus>), IssueStatusesLoaded(Vec<IssueStatus>),
@ -163,7 +163,7 @@ impl From<WsMsgIssueStatus> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgComment { pub enum WsMsgComment {
IssueCommentsLoad(IssueId), IssueCommentsLoad(IssueId),
IssueCommentsLoaded(Vec<Comment>), IssueCommentsLoaded(Vec<Comment>),
@ -181,7 +181,7 @@ impl From<WsMsgComment> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgInvitation { pub enum WsMsgInvitation {
InvitationListLoad, InvitationListLoad,
InvitationListLoaded(Vec<Invitation>), InvitationListLoaded(Vec<Invitation>),
@ -218,7 +218,7 @@ impl From<WsMsgInvitation> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgEpic { pub enum WsMsgEpic {
EpicsLoad, EpicsLoad,
EpicsLoaded(Vec<Epic>), EpicsLoaded(Vec<Epic>),
@ -237,7 +237,7 @@ pub enum WsMsgEpic {
EpicTransform(EpicId, IssueType), EpicTransform(EpicId, IssueType),
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgProject { pub enum WsMsgProject {
ProjectsLoad, ProjectsLoad,
ProjectsLoaded(Vec<Project>), ProjectsLoaded(Vec<Project>),
@ -255,7 +255,7 @@ impl From<WsMsgProject> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgSession { pub enum WsMsgSession {
// auth // auth
AuthorizeLoad(Uuid), AuthorizeLoad(Uuid),
@ -279,7 +279,7 @@ impl From<WsMsgSession> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgUser { pub enum WsMsgUser {
// users // users
AvatarUrlChanged(UserId, AvatarUrl), AvatarUrlChanged(UserId, AvatarUrl),
@ -297,7 +297,7 @@ impl From<WsMsgUser> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsgMessage { pub enum WsMsgMessage {
// messages // messages
MessageUpdated(Message), MessageUpdated(Message),
@ -313,7 +313,7 @@ impl From<WsMsgMessage> for WsMsg {
} }
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum WsMsg { pub enum WsMsg {
Ping, Ping,
Pong, Pong,

View File

@ -5,20 +5,20 @@ use crate::{
ProjectId, TimeTracking, UserId, ProjectId, TimeTracking, UserId,
}; };
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct CreateCommentPayload { pub struct CreateCommentPayload {
pub user_id: Option<UserId>, pub user_id: Option<UserId>,
pub issue_id: IssueId, pub issue_id: IssueId,
pub body: String, pub body: String,
} }
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct UpdateCommentPayload { pub struct UpdateCommentPayload {
pub id: CommentId, pub id: CommentId,
pub body: String, pub body: String,
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct CreateIssuePayload { pub struct CreateIssuePayload {
pub title: String, pub title: String,
pub issue_type: IssueType, pub issue_type: IssueType,
@ -35,7 +35,7 @@ pub struct CreateIssuePayload {
pub epic_id: Option<EpicId>, pub epic_id: Option<EpicId>,
} }
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct UpdateProjectPayload { pub struct UpdateProjectPayload {
pub id: ProjectId, pub id: ProjectId,
pub name: Option<String>, pub name: Option<String>,
@ -45,7 +45,7 @@ pub struct UpdateProjectPayload {
pub time_tracking: Option<TimeTracking>, pub time_tracking: Option<TimeTracking>,
} }
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub enum PayloadVariant { pub enum PayloadVariant {
OptionI32(Option<i32>), OptionI32(Option<i32>),
VecI32(Vec<i32>), VecI32(Vec<i32>),
@ -56,7 +56,7 @@ pub enum PayloadVariant {
ProjectCategory(ProjectCategory), ProjectCategory(ProjectCategory),
} }
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, PartialOrd)] #[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize)]
pub struct UpdateIssuePayload { pub struct UpdateIssuePayload {
pub title: String, pub title: String,
pub issue_type: IssueType, pub issue_type: IssueType,

View File

@ -0,0 +1,35 @@
[package]
name = "bitque"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
description = "JIRS (Simplified JIRA in Rust) Actix server"
repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0"
#license-file = "../LICENSE"
[features]
aws-s3 = ["amazon-actor"]
local-storage = ["filesystem-actor"]
default = ["local-storage"]
[dependencies]
actix = { version = "0" }
amazon-actor = { workspace = true, optional = true }
bitque-config = { workspace = true, features = ["web", "websocket", "local-storage", "hi", "database"] }
bitque-data = { workspace = true, features = ["backend"] }
common = { workspace = true }
database-actor = { workspace = true }
dotenv = { version = "*" }
filesystem-actor = { workspace = true, optional = true }
futures = { version = "*" }
highlight-actor = { workspace = true }
libc = { version = "0.2.0", default-features = false }
mail-actor = { workspace = true }
openssl-sys = { version = "*", features = ["vendored"] }
serde = { version = "*", features = ["derive"] }
serde_json = { version = ">=0.8.0, <2.0" }
tokio = { version = "1", features = ["full"] }
toml = { version = "0.7.3" }
web-actor = { workspace = true, features = ["local-storage"] }
websocket-actor = { workspace = true }

View File

@ -8,12 +8,12 @@ RUN rustup toolchain install nightly && \
RUN cargo install diesel_cli --no-default-features --features postgres RUN cargo install diesel_cli --no-default-features --features postgres
ADD jirs-server /app/jirs-server ADD bitque-server /app/bitque-server
ADD jirs-data /app/jirs-data ADD bitque-data /app/bitque-data
RUN pacman -Sy openssl openssh pkgconf --noconfirm RUN pacman -Sy openssl openssh pkgconf --noconfirm
RUN pkg-config --libs openssl RUN pkg-config --libs openssl
CMD cd /app/jirs-server && \ CMD cd /app/bitque-server && \
$HOME/.cargo/bin/diesel setup --database-url=$DATABASE_URL && \ $HOME/.cargo/bin/diesel setup --database-url=$DATABASE_URL && \
cargo run --bin jirs_server cargo run --bin bitque_server

View File

@ -1,7 +1,7 @@
use actix_web::HttpResponse; use actix_web::HttpResponse;
use common::*; use common::*;
use jirs_data::msg::WsError; use bitque_data::msg::WsError;
use jirs_data::ErrorResponse; use bitque_data::ErrorResponse;
const TOKEN_NOT_FOUND: &str = "Token not found"; const TOKEN_NOT_FOUND: &str = "Token not found";
const DATABASE_CONNECTION_FAILED: &str = "Database connection failed"; const DATABASE_CONNECTION_FAILED: &str = "Database connection failed";

View File

@ -21,28 +21,28 @@ async fn main() -> Result<(), String> {
dotenv::dotenv().ok(); dotenv::dotenv().ok();
pretty_env_logger::init(); pretty_env_logger::init();
let web_config = jirs_config::web::Configuration::read(); let web_config = bitque_config::web::Configuration::read();
let db_addr = actix::SyncArbiter::start( let db_addr = actix::SyncArbiter::start(
jirs_config::database::Configuration::read().concurrency, bitque_config::database::Configuration::read().concurrency,
database_actor::DbExecutor::default, database_actor::DbExecutor::default,
); );
let mail_addr = actix::SyncArbiter::start( let mail_addr = actix::SyncArbiter::start(
jirs_config::mail::Configuration::read().concurrency, bitque_config::mail::Configuration::read().concurrency,
mail_actor::MailExecutor::default, mail_actor::MailExecutor::default,
); );
let hi_addr = actix::SyncArbiter::start( let hi_addr = actix::SyncArbiter::start(
jirs_config::hi::Configuration::read().concurrency, bitque_config::hi::Configuration::read().concurrency,
highlight_actor::HighlightActor::default, highlight_actor::HighlightActor::default,
); );
#[cfg(feature = "local-storage")] #[cfg(feature = "local-storage")]
let fs_addr = actix::SyncArbiter::start( let fs_addr = actix::SyncArbiter::start(
jirs_config::fs::Configuration::read().concurrency, bitque_config::fs::Configuration::read().concurrency,
filesystem_actor::FileSystemExecutor::default, filesystem_actor::FileSystemExecutor::default,
); );
#[cfg(feature = "aws-s3")] #[cfg(feature = "aws-s3")]
let amazon_addr = actix::SyncArbiter::start( let amazon_addr = actix::SyncArbiter::start(
jirs_config::web::Configuration::read().concurrency, bitque_config::web::Configuration::read().concurrency,
amazon_actor::AmazonExecutor::default, amazon_actor::AmazonExecutor::default,
); );

10
crates/common/Cargo.toml Normal file
View File

@ -0,0 +1,10 @@
[package]
name = "common"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
description = "JIRS (Simplified JIRA in Rust) Actix server"
repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0"
[dependencies]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"
@ -13,46 +13,31 @@ name = "database_actor"
path = "./src/lib.rs" path = "./src/lib.rs"
[dependencies] [dependencies]
common = { path = "../../shared/common" } actix = { version = "0.13.0" }
actix = { version = "0.10.0" } bigdecimal = { version = "0.3.0" }
serde = { version = "*" }
bincode = { version = "*" } bincode = { version = "*" }
toml = { version = "*" } bitflags = { version = "2.0.2" }
bitque-config = { workspace = true, features = ["database"] }
futures = { version = "0.3.8" } bitque-data = { workspace = true, features = ["backend"] }
openssl-sys = { version = "*", features = ["vendored"] }
libc = { version = "0.2.0", default-features = false }
pq-sys = { version = ">=0.3.0, <0.5.0" }
r2d2 = { version = ">= 0.8, < 0.9" }
dotenv = { version = "*" }
byteorder = { version = "1.0" } byteorder = { version = "1.0" }
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
time = { version = "0.1" } common = { workspace = true }
url = { version = "2.1.0" } derive_db_execute = { workspace = true }
percent-encoding = { version = "2.1.0" } diesel = { version = "2.0.3", features = ["postgres", "numeric", "uuid", "r2d2", "chrono"] }
uuid = { version = "0.8.2", features = ["serde", "v4", "v5"] } dotenv = { version = "*" }
ipnetwork = { version = ">=0.12.2, <0.17.0" } futures = { version = "0.3.8" }
num-bigint = { version = ">=0.1.41, <0.3" } ipnetwork = { version = "0.20.0" }
num-traits = { version = "0.2" } libc = { version = "0.2.0", default-features = false }
num-bigint = { version = "0.4.3" }
num-integer = { version = "0.1.32" } num-integer = { version = "0.1.32" }
bigdecimal = { version = ">= 0.0.10, <= 0.1.0" } num-traits = { version = "0.2" }
bitflags = { version = "1.0" } openssl-sys = { version = "*", features = ["vendored"] }
percent-encoding = { version = "2.1.0" }
[dependencies.jirs-config] pq-sys = { version = ">=0.3.0, <0.5.0" }
path = "../../shared/jirs-config" r2d2 = { version = ">= 0.8, < 0.9" }
features = ["database"] serde = { version = "*" }
time = { version = "0.3.20" }
[dependencies.jirs-data] toml = { version = "*" }
path = "../../shared/jirs-data" tracing = { version = "0.1.37" }
features = ["backend"] url = { version = "2.1.0" }
uuid = { version = "1.3.0", features = ["serde", "v4", "v5"] }
[dependencies.derive_db_execute]
path = "../../derive/derive_db_execute"
[dependencies.diesel]
version = "1.4.8"
features = [ "postgres", "numeric", "uuidv07", "r2d2", "chrono" ]

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::User; use bitque_data::User;
use crate::db_find; use crate::db_find;
use crate::tokens::FindAccessToken; use crate::tokens::FindAccessToken;

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{Comment, CommentId, IssueId, UserId}; use bitque_data::{Comment, CommentId, IssueId, UserId};
use crate::{db_create, db_delete, db_load, db_update}; use crate::{db_create, db_delete, db_load, db_update};

View File

@ -1,6 +1,6 @@
use derive_db_execute::Execute; use derive_db_execute::Execute;
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{DescriptionString, EndsAt, Epic, EpicId, ProjectId, StartsAt}; use bitque_data::{DescriptionString, EndsAt, Epic, EpicId, ProjectId, StartsAt};
use crate::{db_create, db_delete, db_load, db_update}; use crate::{db_create, db_delete, db_load, db_update};

View File

@ -1,4 +1,4 @@
use jirs_data::{EmailString, UsernameString}; use bitque_data::{EmailString, UsernameString};
#[derive(Debug)] #[derive(Debug)]
pub enum OperationError { pub enum OperationError {

View File

@ -1,6 +1,6 @@
use actix::{Handler, Message}; use actix::{Handler, Message};
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{ use bitque_data::{
EmailString, Invitation, InvitationId, InvitationState, InvitationToken, ProjectId, Token, EmailString, Invitation, InvitationId, InvitationState, InvitationToken, ProjectId, Token,
User, UserId, UserRole, UsernameString, User, UserId, UserRole, UsernameString,
}; };

View File

@ -1,6 +1,6 @@
use diesel::expression::dsl::not;
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{IssueAssignee, IssueId, UserId}; use diesel::dsl::not;
use bitque_data::{IssueAssignee, IssueId, UserId};
use crate::{db_create, db_delete, db_load, db_load_field}; use crate::{db_create, db_delete, db_load, db_load_field};

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{IssueStatus, IssueStatusId, Position, ProjectId, TitleString}; use bitque_data::{IssueStatus, IssueStatusId, Position, ProjectId, TitleString};
use crate::{db_create, db_delete, db_load, db_update}; use crate::{db_create, db_delete, db_load, db_update};

View File

@ -1,7 +1,7 @@
use derive_db_execute::Execute; use derive_db_execute::Execute;
use diesel::expression::sql_literal::sql; use diesel::dsl::sql;
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{IssueId, IssuePriority, IssueStatusId, IssueType, ProjectId, UserId}; use bitque_data::{IssueId, IssuePriority, IssueStatusId, IssueType, ProjectId, UserId};
use crate::models::Issue; use crate::models::Issue;
@ -28,21 +28,21 @@ pub struct LoadProjectIssues {
#[derive(Default, Execute)] #[derive(Default, Execute)]
#[db_exec(result = "Issue", schema = "issues")] #[db_exec(result = "Issue", schema = "issues")]
pub struct UpdateIssue { pub struct UpdateIssue {
pub issue_id: jirs_data::IssueId, pub issue_id: bitque_data::IssueId,
pub title: Option<String>, pub title: Option<String>,
pub issue_type: Option<IssueType>, pub issue_type: Option<IssueType>,
pub priority: Option<IssuePriority>, pub priority: Option<IssuePriority>,
pub list_position: Option<jirs_data::ListPosition>, pub list_position: Option<bitque_data::ListPosition>,
pub description: Option<String>, pub description: Option<String>,
pub description_text: Option<String>, pub description_text: Option<String>,
pub estimate: Option<i32>, pub estimate: Option<i32>,
pub time_spent: Option<i32>, pub time_spent: Option<i32>,
pub time_remaining: Option<i32>, pub time_remaining: Option<i32>,
pub project_id: Option<jirs_data::ProjectId>, pub project_id: Option<bitque_data::ProjectId>,
pub user_ids: Option<Vec<jirs_data::UserId>>, pub user_ids: Option<Vec<bitque_data::UserId>>,
pub reporter_id: Option<jirs_data::UserId>, pub reporter_id: Option<bitque_data::UserId>,
pub issue_status_id: Option<jirs_data::IssueStatusId>, pub issue_status_id: Option<bitque_data::IssueStatusId>,
pub epic_id: Option<Option<jirs_data::EpicId>>, pub epic_id: Option<Option<bitque_data::EpicId>>,
} }
impl UpdateIssue { impl UpdateIssue {
@ -88,7 +88,7 @@ impl UpdateIssue {
)) ))
.get_result(conn) .get_result(conn)
.map_err(|e| { .map_err(|e| {
common::log::debug!("{:?}", e); ::tracing::debug!("{:?}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Create, crate::OperationError::Create,
crate::ResourceKind::Issue, crate::ResourceKind::Issue,
@ -114,7 +114,7 @@ pub struct DeleteIssue {
mod inner { mod inner {
use derive_db_execute::Execute; use derive_db_execute::Execute;
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{IssuePriority, IssueStatusId, IssueType}; use bitque_data::{IssuePriority, IssueStatusId, IssueType};
use crate::models::Issue; use crate::models::Issue;
@ -153,9 +153,9 @@ mod inner {
pub estimate: Option<i32>, pub estimate: Option<i32>,
pub time_spent: Option<i32>, pub time_spent: Option<i32>,
pub time_remaining: Option<i32>, pub time_remaining: Option<i32>,
pub project_id: jirs_data::ProjectId, pub project_id: bitque_data::ProjectId,
pub reporter_id: jirs_data::UserId, pub reporter_id: bitque_data::UserId,
pub epic_id: Option<jirs_data::EpicId>, pub epic_id: Option<bitque_data::EpicId>,
} }
} }
@ -171,10 +171,10 @@ pub struct CreateIssue {
pub estimate: Option<i32>, pub estimate: Option<i32>,
pub time_spent: Option<i32>, pub time_spent: Option<i32>,
pub time_remaining: Option<i32>, pub time_remaining: Option<i32>,
pub project_id: jirs_data::ProjectId, pub project_id: bitque_data::ProjectId,
pub reporter_id: jirs_data::UserId, pub reporter_id: bitque_data::UserId,
pub user_ids: Vec<jirs_data::UserId>, pub user_ids: Vec<bitque_data::UserId>,
pub epic_id: Option<jirs_data::EpicId>, pub epic_id: Option<bitque_data::EpicId>,
} }
impl CreateIssue { impl CreateIssue {
@ -186,7 +186,7 @@ impl CreateIssue {
.select(sql("COALESCE(max(list_position), 0) + 1")) .select(sql("COALESCE(max(list_position), 0) + 1"))
.get_result::<i32>(conn) .get_result::<i32>(conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("resolve new issue position failed {}", e); ::tracing::error!("resolve new issue position failed {}", e);
crate::DatabaseError::Issue(crate::IssueError::BadListPosition) crate::DatabaseError::Issue(crate::IssueError::BadListPosition)
})?; })?;
let i_s_id: IssueStatusId = if msg.issue_status_id == 0 { let i_s_id: IssueStatusId = if msg.issue_status_id == 0 {
@ -195,7 +195,7 @@ impl CreateIssue {
} }
.execute(conn) .execute(conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("Failed to find issue status. {:?}", e); ::tracing::error!("Failed to find issue status. {:?}", e);
e e
})? })?
.first() .first()
@ -229,7 +229,7 @@ impl CreateIssue {
} }
.execute(conn) .execute(conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("Failed to insert issue. {:?}", e); ::tracing::error!("Failed to insert issue. {:?}", e);
e e
})?; })?;
if !assign_users.is_empty() { if !assign_users.is_empty() {
@ -239,12 +239,12 @@ impl CreateIssue {
} }
.execute(conn) .execute(conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("Failed to apply multiple assignee to issue. {:?}", e); ::tracing::error!("Failed to apply multiple assignee to issue. {:?}", e);
e e
})?; })?;
} }
issues.find(issue.id).get_result(conn).map_err(|e| { issues.find(issue.id).get_result(conn).map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Create, crate::OperationError::Create,
crate::ResourceKind::Issue, crate::ResourceKind::Issue,

View File

@ -31,7 +31,7 @@ pub type DbPooledConn = r2d2::PooledConnection<ConnectionManager<PgConnection>>;
pub struct DbExecutor { pub struct DbExecutor {
pub pool: DbPool, pub pool: DbPool,
pub config: jirs_config::database::Configuration, pub config: bitque_config::database::Configuration,
} }
impl Actor for DbExecutor { impl Actor for DbExecutor {
@ -42,14 +42,14 @@ impl Default for DbExecutor {
fn default() -> Self { fn default() -> Self {
Self { Self {
pool: build_pool(), pool: build_pool(),
config: jirs_config::database::Configuration::read(), config: bitque_config::database::Configuration::read(),
} }
} }
} }
pub fn build_pool() -> DbPool { pub fn build_pool() -> DbPool {
dotenv::dotenv().ok(); dotenv::dotenv().ok();
let config = jirs_config::database::Configuration::read(); let config = bitque_config::database::Configuration::read();
let manager = ConnectionManager::<PgConnection>::new(&config.database_url); let manager = ConnectionManager::<PgConnection>::new(&config.database_url);
r2d2::Pool::builder() r2d2::Pool::builder()
@ -75,7 +75,7 @@ impl<'l> Guard<'l> {
use diesel::prelude::*; use diesel::prelude::*;
let tm = conn.transaction_manager(); let tm = conn.transaction_manager();
tm.begin_transaction(conn).map_err(|e| { tm.begin_transaction(conn).map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
crate::DatabaseError::DatabaseConnectionLost crate::DatabaseError::DatabaseConnectionLost
})?; })?;
Ok(Self { conn, tm }) Ok(Self { conn, tm })
@ -91,15 +91,15 @@ impl<'l> Guard<'l> {
match r { match r {
Ok(r) => { Ok(r) => {
self.tm.commit_transaction(self.conn).map_err(|e| { self.tm.commit_transaction(self.conn).map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
crate::DatabaseError::DatabaseConnectionLost crate::DatabaseError::DatabaseConnectionLost
})?; })?;
Ok(r) Ok(r)
} }
Err(e) => { Err(e) => {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
self.tm.rollback_transaction(self.conn).map_err(|e| { self.tm.rollback_transaction(self.conn).map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
crate::DatabaseError::DatabaseConnectionLost crate::DatabaseError::DatabaseConnectionLost
})?; })?;
Err(e) Err(e)

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{BindToken, Message, MessageId, MessageType, User, UserId}; use bitque_data::{BindToken, Message, MessageId, MessageType, User, UserId};
use crate::users::{FindUser, LookupUser}; use crate::users::{FindUser, LookupUser};
use crate::{db_create, db_delete, db_load}; use crate::{db_create, db_delete, db_load};

View File

@ -1,5 +1,5 @@
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use jirs_data::{ use bitque_data::{
EpicId, InvitationState, IssuePriority, IssueStatusId, IssueType, ProjectCategory, ProjectId, EpicId, InvitationState, IssuePriority, IssueStatusId, IssueType, ProjectCategory, ProjectId,
TimeTracking, UserId, TimeTracking, UserId,
}; };
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use crate::schema::*; use crate::schema::*;
#[derive(Serialize, Debug, Deserialize, Queryable)] #[derive(Debug, Deserialize, Queryable, Serialize)]
pub struct Issue { pub struct Issue {
pub id: i32, pub id: i32,
pub title: String, pub title: String,
@ -27,9 +27,9 @@ pub struct Issue {
pub epic_id: Option<EpicId>, pub epic_id: Option<EpicId>,
} }
impl Into<jirs_data::Issue> for Issue { impl Into<bitque_data::Issue> for Issue {
fn into(self) -> jirs_data::Issue { fn into(self) -> bitque_data::Issue {
jirs_data::Issue { bitque_data::Issue {
id: self.id, id: self.id,
title: self.title, title: self.title,
issue_type: self.issue_type, issue_type: self.issue_type,
@ -52,8 +52,8 @@ impl Into<jirs_data::Issue> for Issue {
} }
} }
#[derive(Debug, Serialize, Deserialize, Insertable)] #[derive(Debug, Deserialize, Insertable, Serialize)]
#[table_name = "issues"] #[diesel(table_name = issues)]
pub struct CreateIssueForm { pub struct CreateIssueForm {
pub title: String, pub title: String,
pub issue_type: IssueType, pub issue_type: IssueType,
@ -70,15 +70,15 @@ pub struct CreateIssueForm {
pub epic_id: Option<EpicId>, pub epic_id: Option<EpicId>,
} }
#[derive(Debug, Serialize, Deserialize, Insertable)] #[derive(Debug, Deserialize, Insertable, Serialize)]
#[table_name = "issue_assignees"] #[diesel(table_name = issue_assignees)]
pub struct CreateIssueAssigneeForm { pub struct CreateIssueAssigneeForm {
pub issue_id: i32, pub issue_id: i32,
pub user_id: i32, pub user_id: i32,
} }
#[derive(Debug, Serialize, Deserialize, Insertable)] #[derive(Debug, Deserialize, Insertable, Serialize)]
#[table_name = "projects"] #[diesel(table_name = projects)]
pub struct UpdateProjectForm { pub struct UpdateProjectForm {
pub name: Option<String>, pub name: Option<String>,
pub url: Option<String>, pub url: Option<String>,
@ -87,8 +87,8 @@ pub struct UpdateProjectForm {
pub time_tracking: Option<TimeTracking>, pub time_tracking: Option<TimeTracking>,
} }
#[derive(Debug, Serialize, Deserialize, Insertable)] #[derive(Debug, Deserialize, Insertable, Serialize)]
#[table_name = "projects"] #[diesel(table_name = projects)]
pub struct CreateProjectForm { pub struct CreateProjectForm {
pub name: String, pub name: String,
pub url: String, pub url: String,
@ -96,16 +96,16 @@ pub struct CreateProjectForm {
pub category: ProjectCategory, pub category: ProjectCategory,
} }
#[derive(Debug, Serialize, Deserialize, Insertable)] #[derive(Debug, Deserialize, Insertable, Serialize)]
#[table_name = "users"] #[diesel(table_name = users)]
pub struct UserForm { pub struct UserForm {
pub name: String, pub name: String,
pub email: String, pub email: String,
pub avatar_url: Option<String>, pub avatar_url: Option<String>,
} }
#[derive(Debug, Serialize, Deserialize, Insertable)] #[derive(Debug, Deserialize, Insertable, Serialize)]
#[table_name = "invitations"] #[diesel(table_name = invitations)]
pub struct InvitationForm { pub struct InvitationForm {
pub name: String, pub name: String,
pub email: String, pub email: String,

View File

@ -2,13 +2,13 @@
macro_rules! db_pool { macro_rules! db_pool {
($self: expr) => { ($self: expr) => {
&$self.pool.get().map_err(|e| { &$self.pool.get().map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::DatabaseConnectionLost $crate::DatabaseError::DatabaseConnectionLost
})? })?
}; };
($self: expr, $pool: expr) => { ($self: expr, $pool: expr) => {
&$pool.get().map_err(|e| { &$pool.get().map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::DatabaseConnectionLost $crate::DatabaseError::DatabaseConnectionLost
})? })?
}; };
@ -18,7 +18,7 @@ macro_rules! db_pool {
macro_rules! q { macro_rules! q {
($q: expr) => {{ ($q: expr) => {{
let q = $q; let q = $q;
common::log::debug!( ::tracing::debug!(
"{}", "{}",
diesel::debug_query::<diesel::pg::Pg, _>(&q).to_string() diesel::debug_query::<diesel::pg::Pg, _>(&q).to_string()
); );
@ -40,7 +40,7 @@ macro_rules! db_find {
$crate::q!($q) $crate::q!($q)
.first($conn) .first($conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::LoadCollection, $crate::OperationError::LoadCollection,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -81,7 +81,7 @@ macro_rules! db_load {
$crate::q!($q) $crate::q!($q)
.load(conn) .load(conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::LoadCollection, $crate::OperationError::LoadCollection,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -120,7 +120,7 @@ macro_rules! db_load_field {
$crate::q!($q) $crate::q!($q)
.load(conn) .load(conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::LoadCollection, $crate::OperationError::LoadCollection,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -162,7 +162,7 @@ macro_rules! db_create {
$crate::q!($q) $crate::q!($q)
.get_result::<$resource>($conn) .get_result::<$resource>($conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::Create, $crate::OperationError::Create,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -205,7 +205,7 @@ macro_rules! db_update {
$crate::q!($q) $crate::q!($q)
.get_result::<$resource>($conn) .get_result::<$resource>($conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::Update, $crate::OperationError::Update,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,
@ -247,7 +247,7 @@ macro_rules! db_delete {
$crate::q!($q) $crate::q!($q)
.execute($conn) .execute($conn)
.map_err(|e| { .map_err(|e| {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
$crate::DatabaseError::GenericFailure( $crate::DatabaseError::GenericFailure(
$crate::OperationError::Delete, $crate::OperationError::Delete,
$crate::ResourceKind::$resource, $crate::ResourceKind::$resource,

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{NameString, Project, ProjectCategory, ProjectId, TimeTracking, UserId}; use bitque_data::{NameString, Project, ProjectCategory, ProjectId, TimeTracking, UserId};
use crate::{db_create, db_find, db_load, db_update}; use crate::{db_create, db_find, db_load, db_update};
@ -12,7 +12,7 @@ db_find! {
mod inner { mod inner {
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{NameString, Project, ProjectCategory, TimeTracking}; use bitque_data::{NameString, Project, ProjectCategory, TimeTracking};
use crate::db_create; use crate::db_create;

View File

@ -1,13 +1,13 @@
diff --git a/jirs-server/src/schema.rs b/jirs-server/src/schema.rs diff --git a/bitque-server/src/schema.rs b/bitque-server/src/schema.rs
index 00d1c0b..5b82ccf 100644 index 00d1c0b..5b82ccf 100644
--- a/jirs-server/src/schema.rs --- a/bitque-server/src/schema.rs
+++ b/jirs-server/src/schema.rs +++ b/bitque-server/src/schema.rs
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
+#![allow(unused_imports, dead_code)] +#![allow(unused_imports, dead_code)]
+ +
table! { table! {
use diesel::sql_types::*; use diesel::sql_types::*;
use jirs_data::*; use bitque_data::*;
/// Representation of the `comments` table. /// Representation of the `comments` table.
/// ///

View File

@ -0,0 +1,224 @@
// @generated automatically by Diesel CLI.
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
comments (id) {
id -> Int4,
body -> Text,
user_id -> Int4,
issue_id -> Int4,
created_at -> Timestamp,
updated_at -> Timestamp,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
epics (id) {
id -> Int4,
name -> Text,
user_id -> Int4,
project_id -> Int4,
created_at -> Timestamp,
updated_at -> Timestamp,
starts_at -> Nullable<Timestamp>,
ends_at -> Nullable<Timestamp>,
description -> Nullable<Text>,
description_html -> Nullable<Text>,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
invitations (id) {
id -> Int4,
name -> Text,
email -> Text,
state -> InvitationState,
project_id -> Int4,
invited_by_id -> Int4,
created_at -> Timestamp,
updated_at -> Timestamp,
bind_token -> Uuid,
role -> UserRole,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
issue_assignees (id) {
id -> Int4,
issue_id -> Int4,
user_id -> Int4,
created_at -> Timestamp,
updated_at -> Timestamp,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
issue_statuses (id) {
id -> Int4,
name -> Varchar,
position -> Int4,
project_id -> Int4,
created_at -> Timestamp,
updated_at -> Timestamp,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
issues (id) {
id -> Int4,
title -> Text,
issue_type -> IssueType,
priority -> IssuePriority,
list_position -> Int4,
description -> Nullable<Text>,
description_text -> Nullable<Text>,
estimate -> Nullable<Int4>,
time_spent -> Nullable<Int4>,
time_remaining -> Nullable<Int4>,
reporter_id -> Int4,
project_id -> Int4,
created_at -> Timestamp,
updated_at -> Timestamp,
issue_status_id -> Int4,
epic_id -> Nullable<Int4>,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
messages (id) {
id -> Int4,
receiver_id -> Int4,
sender_id -> Int4,
summary -> Text,
description -> Text,
message_type -> MessageType,
hyper_link -> Text,
created_at -> Timestamp,
updated_at -> Timestamp,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
projects (id) {
id -> Int4,
name -> Text,
url -> Text,
description -> Text,
category -> ProjectCategory,
created_at -> Timestamp,
updated_at -> Timestamp,
time_tracking -> TimeTracking,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
tokens (id) {
id -> Int4,
user_id -> Int4,
access_token -> Uuid,
refresh_token -> Uuid,
created_at -> Timestamp,
updated_at -> Timestamp,
bind_token -> Nullable<Uuid>,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
user_projects (id) {
id -> Int4,
user_id -> Int4,
project_id -> Int4,
is_default -> Bool,
is_current -> Bool,
role -> UserRole,
created_at -> Timestamp,
updated_at -> Timestamp,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
user_settings (id) {
id -> Int4,
user_id -> Int4,
text_editor_mode -> TextEditorMode,
}
}
diesel::table! {
use diesel::sql_types::*;
use bitque_data::*;
users (id) {
id -> Int4,
name -> Text,
email -> Text,
avatar_url -> Nullable<Text>,
created_at -> Timestamp,
updated_at -> Timestamp,
}
}
diesel::joinable!(comments -> issues (issue_id));
diesel::joinable!(comments -> users (user_id));
diesel::joinable!(epics -> projects (project_id));
diesel::joinable!(epics -> users (user_id));
diesel::joinable!(invitations -> projects (project_id));
diesel::joinable!(invitations -> users (invited_by_id));
diesel::joinable!(issue_assignees -> issues (issue_id));
diesel::joinable!(issue_assignees -> users (user_id));
diesel::joinable!(issue_statuses -> projects (project_id));
diesel::joinable!(issues -> epics (epic_id));
diesel::joinable!(issues -> issue_statuses (issue_status_id));
diesel::joinable!(issues -> projects (project_id));
diesel::joinable!(issues -> users (reporter_id));
diesel::joinable!(tokens -> users (user_id));
diesel::joinable!(user_projects -> projects (project_id));
diesel::joinable!(user_projects -> users (user_id));
diesel::joinable!(user_settings -> users (user_id));
diesel::allow_tables_to_appear_in_same_query!(
comments,
epics,
invitations,
issue_assignees,
issue_statuses,
issues,
messages,
projects,
tokens,
user_projects,
user_settings,
users,
);

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{Token, UserId}; use bitque_data::{Token, UserId};
use crate::{db_create, db_find, db_update}; use crate::{db_create, db_find, db_update};

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{ProjectId, UserId, UserProject, UserProjectId, UserRole}; use bitque_data::{ProjectId, UserId, UserProject, UserProjectId, UserRole};
use crate::{db_create, db_delete, db_find, db_load, db_update}; use crate::{db_create, db_delete, db_find, db_load, db_update};
@ -27,7 +27,7 @@ db_load! {
mod inner { mod inner {
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{UserId, UserProject, UserProjectId}; use bitque_data::{UserId, UserProject, UserProjectId};
use crate::db_update; use crate::db_update;

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{TextEditorMode, UserId, UserSetting}; use bitque_data::{TextEditorMode, UserId, UserSetting};
use crate::{db_find, db_update}; use crate::{db_find, db_update};
@ -30,7 +30,7 @@ db_update! {
mod inner { mod inner {
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{TextEditorMode, UserId, UserSetting}; use bitque_data::{TextEditorMode, UserId, UserSetting};
use crate::{db_create, db_update}; use crate::{db_create, db_update};

View File

@ -1,5 +1,5 @@
use diesel::prelude::*; use diesel::prelude::*;
use jirs_data::{EmailString, IssueId, ProjectId, User, UserId, UserRole, UsernameString}; use bitque_data::{EmailString, IssueId, ProjectId, User, UserId, UserRole, UsernameString};
use crate::projects::CreateProject; use crate::projects::CreateProject;
use crate::user_projects::CreateUserProject; use crate::user_projects::CreateUserProject;
@ -154,7 +154,7 @@ db_update! {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use diesel::connection::TransactionManager; use diesel::connection::TransactionManager;
use jirs_data::{Project, ProjectCategory}; use bitque_data::{Project, ProjectCategory};
use super::*; use super::*;
use crate::build_pool; use crate::build_pool;

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"

View File

@ -157,7 +157,7 @@ fn build_create_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).get_result(conn).map_err(|e| {{ crate::q!({query}).get_result(conn).map_err(|e| {{
common::log::error!("{{:?}}", e); ::tracing::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Create, crate::OperationError::Create,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -192,7 +192,7 @@ fn build_find_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).first(conn).map_err(|e| {{ crate::q!({query}).first(conn).map_err(|e| {{
common::log::error!("{{:?}}", e); ::tracing::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::LoadSingle, crate::OperationError::LoadSingle,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -226,7 +226,7 @@ fn build_load_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).load(conn).map_err(|e| {{ crate::q!({query}).load(conn).map_err(|e| {{
common::log::error!("{{:?}}", e); ::tracing::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::LoadCollection, crate::OperationError::LoadCollection,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -260,7 +260,7 @@ fn build_update_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).get_result(conn).map_err(|e| {{ crate::q!({query}).get_result(conn).map_err(|e| {{
common::log::error!("{{:?}}", e); ::tracing::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Update, crate::OperationError::Update,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},
@ -294,7 +294,7 @@ fn build_destroy_exec(
use crate::schema::{schema}::dsl::*; use crate::schema::{schema}::dsl::*;
let msg = self; let msg = self;
crate::q!({query}).execute(conn).map_err(|e| {{ crate::q!({query}).execute(conn).map_err(|e| {{
common::log::error!("{{:?}}", e); ::tracing::error!("{{:?}}", e);
crate::DatabaseError::GenericFailure( crate::DatabaseError::GenericFailure(
crate::OperationError::Delete, crate::OperationError::Delete,
crate::ResourceKind::{resource}, crate::ResourceKind::{resource},

View File

@ -3,7 +3,7 @@ use std::iter::Peekable;
use proc_macro::token_stream::IntoIter; use proc_macro::token_stream::IntoIter;
use proc_macro::TokenTree; use proc_macro::TokenTree;
#[derive(Default, Debug)] #[derive(Debug, Default)]
pub struct Attributes { pub struct Attributes {
pub result: Option<String>, pub result: Option<String>,
pub schema: Option<String>, pub schema: Option<String>,

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"
@ -13,16 +13,10 @@ name = "filesystem_actor"
path = "./src/lib.rs" path = "./src/lib.rs"
[dependencies] [dependencies]
common = { path = "../../shared/common" } actix = { version = "0.13.0" }
actix = { version = "0.10.0" } actix-files = { version = "0.6.2" }
actix-files = { version = "0.5.0" } bitque-config = { workspace = true, features = ["local-storage"] }
bytes = { version = "1.4.0" }
common = { workspace = true }
futures = { version = "0.3.8" } futures = { version = "0.3.8" }
tokio = { version = "1", features = ["full"] }
[dependencies.jirs-config]
path = "../../shared/jirs-config"
features = ["local-storage"]
[dependencies.tokio]
version = "0.2.23"
features = ["dns"]

View File

@ -3,7 +3,7 @@ use std::path::PathBuf;
use actix::SyncContext; use actix::SyncContext;
use actix_files::{self, Files}; use actix_files::{self, Files};
use jirs_config::fs::Configuration; use bitque_config::fs::Configuration;
#[derive(Debug)] #[derive(Debug)]
pub enum FsError { pub enum FsError {
@ -42,7 +42,7 @@ impl actix::Actor for FileSystemExecutor {
#[derive(actix::Message)] #[derive(actix::Message)]
#[rtype(result = "Result<usize, FsError>")] #[rtype(result = "Result<usize, FsError>")]
pub struct CreateFile { pub struct CreateFile {
pub source: tokio::sync::broadcast::Receiver<common::bytes::Bytes>, pub source: tokio::sync::broadcast::Receiver<bytes::Bytes>,
pub file_name: String, pub file_name: String,
} }

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"
@ -13,23 +13,14 @@ name = "highlight_actor"
path = "./src/lib.rs" path = "./src/lib.rs"
[dependencies] [dependencies]
common = { path = "../../shared/common" } actix = { version = "0.13.0" }
actix = { version = "0.10.0" } bincode = { version = "*" }
bitque-config = { workspace = true, features = ["hi"] }
serde = "*" bitque-data = { workspace = true, features = ["backend"] }
bincode = "*" common = { workspace = true }
toml = { version = "*" }
simsearch = { version = "0.2" }
flate2 = { version = "*" } flate2 = { version = "*" }
syntect = { version = "*" }
lazy_static = { version = "*" } lazy_static = { version = "*" }
serde = { version = "*" }
[dependencies.jirs-config] simsearch = { version = "0.2" }
path = "../../shared/jirs-config" syntect = { version = "*" }
features = ["hi"] toml = { version = "*" }
[dependencies.jirs-data]
path = "../../shared/jirs-data"
features = ["backend"]

View File

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use actix::{Actor, Handler, SyncContext}; use actix::{Actor, Handler, SyncContext};
use jirs_data::HighlightedCode; use bitque_data::HighlightedCode;
use simsearch::SimSearch; use simsearch::SimSearch;
use syntect::easy::HighlightLines; use syntect::easy::HighlightLines;
use syntect::highlighting::{Style, ThemeSet}; use syntect::highlighting::{Style, ThemeSet};
@ -79,7 +79,14 @@ impl HighlightActor {
.ok_or(HighlightError::UnknownTheme)?; .ok_or(HighlightError::UnknownTheme)?;
let mut hi = HighlightLines::new(set, theme); let mut hi = HighlightLines::new(set, theme);
Ok(hi.highlight(code, self.syntax_set.as_ref()))
let mut res = Vec::with_capacity(code.split_ascii_whitespace().count());
for line in code.lines() {
res.extend(hi.highlight_line(line, self.syntax_set.as_ref()).map_err(|_e| {
HighlightError::UnknownLanguage
})?.iter());
}
Ok(res)
} }
} }
@ -105,14 +112,14 @@ impl Handler<HighlightCode> for HighlightActor {
.into_iter() .into_iter()
.map(|(style, part)| { .map(|(style, part)| {
( (
jirs_data::Style { bitque_data::Style {
foreground: jirs_data::Color { foreground: bitque_data::Color {
r: style.foreground.r, r: style.foreground.r,
g: style.foreground.g, g: style.foreground.g,
b: style.foreground.b, b: style.foreground.b,
a: style.foreground.a, a: style.foreground.a,
}, },
background: jirs_data::Color { background: bitque_data::Color {
r: style.background.r, r: style.background.r,
g: style.background.g, g: style.background.g,
b: style.background.b, b: style.background.b,
@ -128,7 +135,7 @@ impl Handler<HighlightCode> for HighlightActor {
} }
} }
#[derive(actix::Message, Default)] #[derive(Default, actix::Message)]
#[rtype(result = "Result<String, HighlightError>")] #[rtype(result = "Result<String, HighlightError>")]
pub struct TextHighlightCode { pub struct TextHighlightCode {
pub code: String, pub code: String,

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types" description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"
@ -13,25 +13,16 @@ name = "mail_actor"
path = "./src/lib.rs" path = "./src/lib.rs"
[dependencies] [dependencies]
common = { path = "../../shared/common" } actix = { version = "0.13.0" }
actix = { version = "0.10.0" } bitque-config = { workspace = true, features = ["mail", "web"] }
common = { workspace = true }
serde = "*"
toml = { version = "*" }
dotenv = { version = "*" } dotenv = { version = "*" }
uuid = { version = "0.8.2", features = ["serde", "v4", "v5"] }
futures = { version = "*" } futures = { version = "*" }
openssl-sys = { version = "*", features = ["vendored"] }
libc = { version = "0.2.0", default-features = false }
lettre = { version = "0.10.0-rc.3" } lettre = { version = "0.10.0-rc.3" }
lettre_email = { version = "*" } lettre_email = { version = "*" }
libc = { version = "0.2.0", default-features = false }
log = { version = "*" } log = { version = "*" }
openssl-sys = { version = "*", features = ["vendored"] }
[dependencies.jirs-config] serde = { version = "*" }
path = "../../shared/jirs-config" toml = { version = "*" }
features = ["mail", "web"] uuid = { version = "1.3.0", features = ["serde", "v4", "v5"] }

View File

@ -22,7 +22,7 @@ impl Handler<Invite> for MailExecutor {
fn handle(&mut self, msg: Invite, _ctx: &mut Self::Context) -> Self::Result { fn handle(&mut self, msg: Invite, _ctx: &mut Self::Context) -> Self::Result {
use lettre::Transport; use lettre::Transport;
let transport = &mut self.transport; let transport = &mut self.transport;
let addr = jirs_config::web::Configuration::read().full_addr(); let addr = bitque_config::web::Configuration::read().full_addr();
let from = email_address(self.config.from.as_str())?; let from = email_address(self.config.from.as_str())?;
let to = email_address(&msg.email)?; let to = email_address(&msg.email)?;

View File

@ -20,7 +20,7 @@ pub enum MailError {
pub struct MailExecutor { pub struct MailExecutor {
pub transport: MailTransport, pub transport: MailTransport,
pub config: jirs_config::mail::Configuration, pub config: bitque_config::mail::Configuration,
} }
impl Actor for MailExecutor { impl Actor for MailExecutor {
@ -29,7 +29,7 @@ impl Actor for MailExecutor {
impl Default for MailExecutor { impl Default for MailExecutor {
fn default() -> Self { fn default() -> Self {
let config = jirs_config::mail::Configuration::read(); let config = bitque_config::mail::Configuration::read();
Self { Self {
transport: mail_transport(&config), transport: mail_transport(&config),
config, config,
@ -37,8 +37,8 @@ impl Default for MailExecutor {
} }
} }
fn mail_client(config: &jirs_config::mail::Configuration) -> lettre::SmtpTransport { fn mail_client(config: &bitque_config::mail::Configuration) -> lettre::SmtpTransport {
let jirs_config::mail::Configuration { let bitque_config::mail::Configuration {
user: mail_user, user: mail_user,
pass: mail_pass, pass: mail_pass,
host: mail_host, host: mail_host,
@ -52,7 +52,7 @@ fn mail_client(config: &jirs_config::mail::Configuration) -> lettre::SmtpTranspo
.build() .build()
} }
fn mail_transport(config: &jirs_config::mail::Configuration) -> MailTransport { fn mail_transport(config: &bitque_config::mail::Configuration) -> MailTransport {
mail_client(config) mail_client(config)
} }

View File

@ -0,0 +1,38 @@
[package]
name = "web-actor"
version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018"
description = "JIRS (Simplified JIRA in Rust) shared data types"
repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0"
#license-file = "../LICENSE"
[lib]
name = "web_actor"
path = "./src/lib.rs"
[features]
local-storage = ["filesystem-actor"]
aws-s3 = ["amazon-actor"]
default = ["local-storage"]
[dependencies]
actix = { version = "0.13.0" }
actix-multipart = { version = "*" }
amazon-actor = { workspace = true, optional = true }
bincode = { version = "*" }
bitque-config = { workspace = true, features = ["mail", "web", "local-storage"] }
bitque-data = { workspace = true, features = ["backend"] }
common = { workspace = true }
database-actor = { workspace = true }
filesystem-actor = { workspace = true, optional = true }
futures = { version = "0.3.8" }
libc = { version = "0.2.0", default-features = false }
mail-actor = { workspace = true }
openssl-sys = { version = "*", features = ["vendored"] }
serde = { version = "*" }
tokio = { version = "1", features = ["full"] }
toml = { version = "*" }
uuid = { version = "1.3.0", features = ["serde", "v4", "v5"] }
websocket-actor = { workspace = true }

View File

@ -13,8 +13,8 @@ use database_actor::DbExecutor;
#[cfg(feature = "local-storage")] #[cfg(feature = "local-storage")]
use futures::executor::block_on; use futures::executor::block_on;
use futures::{StreamExt, TryStreamExt}; use futures::{StreamExt, TryStreamExt};
use jirs_data::msg::{WsMsg, WsMsgUser}; use bitque_data::msg::{WsMsg, WsMsgUser};
use jirs_data::{User, UserId}; use bitque_data::{User, UserId};
use websocket_actor::server::InnerMsg::BroadcastToChannel; use websocket_actor::server::InnerMsg::BroadcastToChannel;
use websocket_actor::server::WsServer; use websocket_actor::server::WsServer;
@ -161,13 +161,13 @@ async fn update_user_avatar(
Ok(Ok(user)) => Ok(user), Ok(Ok(user)) => Ok(user),
Ok(Err(e)) => { Ok(Err(e)) => {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
Err(actix_web::Error::from( Err(actix_web::Error::from(
HttpResponse::Unauthorized().finish(), HttpResponse::Unauthorized().finish(),
)) ))
} }
Err(e) => { Err(e) => {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
Err(actix_web::Error::from( Err(actix_web::Error::from(
HttpResponse::Unauthorized().finish(), HttpResponse::Unauthorized().finish(),
)) ))
@ -192,11 +192,11 @@ async fn handle_token(
Ok(Ok(user)) => Ok(user.id), Ok(Ok(user)) => Ok(user.id),
Ok(Err(e)) => { Ok(Err(e)) => {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
Err(HttpResponse::Unauthorized().finish().into()) Err(HttpResponse::Unauthorized().finish().into())
} }
Err(e) => { Err(e) => {
common::log::error!("{:?}", e); ::tracing::error!("{:?}", e);
Err(HttpResponse::Unauthorized().finish().into()) Err(HttpResponse::Unauthorized().finish().into())
} }
} }

View File

@ -1,7 +1,7 @@
use actix_web::HttpResponse; use actix_web::HttpResponse;
use common::*; use common::*;
use jirs_data::msg::WsError; use bitque_data::msg::WsError;
use jirs_data::ErrorResponse; use bitque_data::ErrorResponse;
const TOKEN_NOT_FOUND: &str = "Token not found"; const TOKEN_NOT_FOUND: &str = "Token not found";
const DATABASE_CONNECTION_FAILED: &str = "Database connection failed"; const DATABASE_CONNECTION_FAILED: &str = "Database connection failed";

View File

@ -5,7 +5,7 @@ use actix_web::web::Data;
use actix_web::Error; use actix_web::Error;
use common::*; use common::*;
use futures::StreamExt; use futures::StreamExt;
use jirs_data::UserId; use bitque_data::UserId;
use tokio::sync::broadcast::{Receiver, Sender}; use tokio::sync::broadcast::{Receiver, Sender};
#[cfg(all(feature = "local-storage", feature = "aws-s3"))] #[cfg(all(feature = "local-storage", feature = "aws-s3"))]
@ -113,7 +113,7 @@ async fn aws_s3(
amazon: Data<Addr<amazon_actor::AmazonExecutor>>, amazon: Data<Addr<amazon_actor::AmazonExecutor>>,
receiver: Receiver<bytes::Bytes>, receiver: Receiver<bytes::Bytes>,
) -> Option<String> { ) -> Option<String> {
let s3 = jirs_config::amazon::config(); let s3 = bitque_config::amazon::config();
if !s3.active { if !s3.active {
return None; return None;
} }
@ -134,11 +134,11 @@ async fn aws_s3(
async fn local_storage_write( async fn local_storage_write(
system_file_name: String, system_file_name: String,
fs: Data<Addr<filesystem_actor::FileSystemExecutor>>, fs: Data<Addr<filesystem_actor::FileSystemExecutor>>,
_user_id: jirs_data::UserId, _user_id: bitque_data::UserId,
receiver: Receiver<bytes::Bytes>, receiver: Receiver<bytes::Bytes>,
) -> Option<String> { ) -> Option<String> {
let web_config = jirs_config::web::config(); let web_config = bitque_config::web::config();
let fs_config = jirs_config::fs::config(); let fs_config = bitque_config::fs::config();
match fs match fs
.send(filesystem_actor::CreateFile { .send(filesystem_actor::CreateFile {

View File

@ -5,7 +5,7 @@ use common::*;
use database_actor::authorize_user::AuthorizeUser; use database_actor::authorize_user::AuthorizeUser;
use database_actor::DbExecutor; use database_actor::DbExecutor;
pub use errors::*; pub use errors::*;
use jirs_data::User; use bitque_data::User;
use crate::middleware::authorize::token_from_headers; use crate::middleware::authorize::token_from_headers;

View File

@ -1,16 +1,16 @@
[package] [package]
name = "jirs_client" name = "bitque_client"
version = "0.1.0" version = "0.1.0"
authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"] authors = ["Adrian Wozniak <adrian.wozniak@ita-prog.pl>"]
edition = "2018" edition = "2018"
description = "JIRS (Simplified JIRA in Rust) WASM client" description = "JIRS (Simplified JIRA in Rust) WASM client"
repository = "https://gitlab.com/adrian.wozniak/jirs" repository = "https://gitlab.com/adrian.wozniak/bitque"
license = "MPL-2.0" license = "MPL-2.0"
#license-file = "../LICENSE" #license-file = "../LICENSE"
[lib] [lib]
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]
name = "jirs_client" name = "bitque_client"
path = "src/lib.rs" path = "src/lib.rs"
[features] [features]
@ -18,38 +18,23 @@ print-model = []
default = [] default = []
[dependencies] [dependencies]
jirs-data = { path = "../shared/jirs-data", features = ["frontend"] } bincode = { version = "*" }
bitque-data = { workspace = true, features = ["frontend"] }
seed = { version = "0.8.0" } chrono = { version = "0.4", default-features = false, features = ["serde", "wasmbind"] }
console_error_panic_hook = { version = "*" }
derive_enum_iter = { workspace = true }
derive_enum_primitive = { workspace = true }
dotenv = { version = "*" }
futures = "0.3.6"
js-sys = { version = "*", default-features = false }
seed = { version = "0.10.0" }
serde = { version = "*" } serde = { version = "*" }
serde_json = { version = "*" } serde_json = { version = "*" }
bincode = { version = "*" } tracing = { version = "0.1.37" }
uuid = { version = "1.3.0", features = ["serde"] }
chrono = { version = "0.4", default-features = false, features = ["serde", "wasmbind"] } wasm-bindgen = { version = "*", features = ["enable-interning"] }
uuid = { version = "0.8.2", features = ["serde"] } wasm-bindgen-futures = { version = "*" }
futures = "0.3.6" wee_alloc = { version = "*", features = ["static_array_backend"] }
dotenv = { version = "*" }
wasm-logger = { version = "*" }
log = "*"
console_error_panic_hook = { version = "*" }
[dependencies.wee_alloc]
version = "*"
features = ["static_array_backend"]
[dependencies.wasm-bindgen]
version = "*"
features = ["enable-interning"]
[dependencies.wasm-bindgen-futures]
version = "*"
[dependencies.js-sys]
version = "*"
default-features = false
[dependencies.web-sys] [dependencies.web-sys]
version = "*" version = "*"
@ -85,11 +70,5 @@ features = [
"DragEvent", "DragEvent",
] ]
[dependencies.derive_enum_primitive]
path = "../derive/derive_enum_primitive"
[dependencies.derive_enum_iter]
path = "../derive/derive_enum_iter"
[dev-dependencies] [dev-dependencies]
wasm-bindgen-test = { version = "*" } wasm-bindgen-test = { version = "*" }

View File

@ -8,14 +8,14 @@ RUN rustup toolchain install nightly && \
rustup default nightly && \ rustup default nightly && \
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
ADD ./jirs-data /app/jirs-data ADD ./bitque-data /app/bitque-data
ADD ./jirs-client /app/jirs-client ADD ./bitque-client /app/bitque-client
RUN cd ./jirs-client && \ RUN cd ./bitque-client && \
rm -Rf build && \ rm -Rf build && \
mkdir build && \ mkdir build && \
wasm-pack build --mode normal --release --out-name jirs --out-dir ./build --target web && \ wasm-pack build --mode normal --release --out-name bitque --out-dir ./build --target web && \
cp -r ./static/* ./build && \ cp -r ./static/* ./build && \
cat ./static/index.js \ cat ./static/index.js \
| sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" \ | sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" \
@ -24,6 +24,6 @@ RUN cd ./jirs-client && \
mkdir -p /assets && \ mkdir -p /assets && \
cp -r ./build/* /assets cp -r ./build/* /assets
CMD cat /app/jirs-client/static/index.js \ CMD cat /app/bitque-client/static/index.js \
| sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" \ | sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" \
| sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> /assets/index.js | sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> /assets/index.js

View File

@ -1,5 +1,3 @@
#![feature(format_args_capture)]
fn main() { fn main() {
if std::fs::metadata("./src/location.rs").is_ok() { if std::fs::metadata("./src/location.rs").is_ok() {
return; return;

Some files were not shown because too many files have changed in this diff Show More