Skip to content

Commit f9cd4e8

Browse files
authored
Start with collection collaboration (IgnisDa#824)
* build(backend): remove tower deps * chore: change the domain name of application * feat(database): migration to change column name for collection * chore(backend): adapt to new database schema * fix(backend): calculate summary correctly * fix(backend): better calculation of summary * chore(frontend): adapt to new gql schema * feat(frontend): add link to people page * chore(database): change name of migration * feat(database): migration to create `user_to_collection` * ci: move commands to single line * feat(database): migration to create new record entries * fix(database): add if guard * feat(database): change the columns around * feat(database): store whether user is a creator * chore(database): change name of column * chore(backend): change the error logged * feat(backend): create new models * feat(*): bring back all user_id column * feat(backend): associate collection with user on creation * feat(backend): use new model to query for user * feat(backend): get collection count in one go * dev: change names of containers * dev: remove version from compose * chore(backend): reduce visibility * feat(backend): return username of creator * chore(docs): remove double quotes from env file * fix(backend): query collections instead of user_to_collection * feat(backend): return names correctly * feat(frontend): how collections are displayed * feat(backend): save creator id when changing association * feat(frontend): do not allow updating custom media * feat(frontend): start new collection schema changes * feat(frontend): get media monitoring button working * chore(backend): change name of gql objects * feat(backend): get user id for collection * feat(frontend): remove from correct collection * feat(frontend): flow collection data correctly * chore(ts-utils): export utility function * feat(frontend): allow adding to collection * chore(frontend): change wording * chore(frontend): change name of param * fix(backend): fetch all collections for entity * fix(backend): associate with collections correctly * fix(backend): merge media should be done in a txn * fix(backend): handle cases when media is already in dest collection * feat(frontend): order of update btns * build(backend): bump version * fix(backend): timezone shenanigans * fix(frontend): better wording * refactor(backend): associate user with entity immediately * docs: add back double quotes * feat(backend): allow storing manga volume * feat(backend): calculate manga volumes * feat(frontend): allow setting volume * fix(frontend): better showing of seen items * chore(backend): add more logging * chore(graphql): get additonal manga details * feat(frontend): display more unit details * feat(frontend): allow reviewing volumes * feat(frontend): better layout for input
1 parent aa3a024 commit f9cd4e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+735
-376
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ryot",
33
"dockerComposeFile": "docker-compose.yml",
4-
"service": "app",
4+
"service": "ryot-app",
55
"forwardPorts": [],
66
"workspaceFolder": "/workspaces/ryot",
77
"postCreateCommand": ". ${containerWorkspaceFolder}/.devcontainer/scripts/post-create.sh",

.devcontainer/docker-compose.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
version: "3.9"
2-
31
services:
4-
app:
2+
ryot-app:
53
build:
64
context: .
75
dockerfile: Dockerfile
@@ -14,7 +12,7 @@ services:
1412
- "5000:5000"
1513
user: archlinux
1614

17-
minio:
15+
ryot-minio:
1816
image: minio/minio
1917
ports:
2018
- "9000:9000"
@@ -23,7 +21,7 @@ services:
2321
- minio_storage:/data
2422
command: server --console-address ":9001" /data
2523

26-
postgres:
24+
ryot-postgres:
2725
image: postgres:16-alpine
2826
restart: unless-stopped
2927
volumes:

.devcontainer/scripts/post-create.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,3 @@
33
# setup the git identities
44
git config --global user.name "${GIT_AUTHOR_NAME}"
55
git config --global user.email "${GIT_AUTHOR_EMAIL}"
6-
7-
# These are available only in a fish environment
8-
fish -c '
9-
# setup dependencies
10-
moon sync projects
11-
'

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<p align="center">
2424
<a href="https://docs.ryot.io" target="_blank">Installation</a> •
2525
<a href="https://docs.ryot.io/configuration" target="_blank">Configuration</a> •
26-
<a href="https://demo.ryot.io" target="_blank">Demo</a>
26+
<a href="https://app.ryot.io" target="_blank">Hosted version</a>
2727
</p>
2828

2929
<br/>

apps/backend/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ryot"
3-
version = "5.2.6"
3+
version = "5.2.7"
44
edition = "2021"
55
repository = "https://github.com/IgnisDa/ryot"
66
license = "GPL-3.0"
@@ -80,7 +80,6 @@ surf = { version = "2.3.2", features = [
8080
"h1-client-rustls",
8181
], default-features = false }
8282
tokio = { version = "1.37.0", features = ["full"] }
83-
tower = { version = "0.4.13", features = ["buffer"] }
8483
tower-http = { version = "0.5.2", features = ["catch-panic", "cors", "trace"] }
8584
tracing = { workspace = true }
8685
tracing-subscriber = "0.3.18"

apps/backend/src/entities/collection.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub struct Model {
1414
pub last_updated_on: DateTimeUtc,
1515
pub name: String,
1616
pub description: Option<String>,
17-
#[graphql(skip)]
1817
pub user_id: i32,
1918
}
2019

@@ -32,6 +31,8 @@ pub enum Relation {
3231
on_delete = "Cascade"
3332
)]
3433
User,
34+
#[sea_orm(has_many = "super::user_to_collection::Entity")]
35+
UserToCollection,
3536
}
3637

3738
impl Related<super::collection_to_entity::Entity> for Entity {
@@ -52,4 +53,10 @@ impl Related<super::user::Entity> for Entity {
5253
}
5354
}
5455

56+
impl Related<super::user_to_collection::Entity> for Entity {
57+
fn to() -> RelationDef {
58+
Relation::UserToCollection.def()
59+
}
60+
}
61+
5562
impl ActiveModelBehavior for ActiveModel {}

apps/backend/src/entities/collection_to_entity.rs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.3
22
3-
use async_trait::async_trait;
43
use sea_orm::entity::prelude::*;
54
use serde::{Deserialize, Serialize};
65

7-
use crate::utils::associate_user_with_entity;
8-
9-
use super::prelude::Collection;
10-
116
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
127
#[sea_orm(table_name = "collection_to_entity")]
138
pub struct Model {
@@ -95,28 +90,4 @@ impl Related<super::exercise::Entity> for Entity {
9590
}
9691
}
9792

98-
#[async_trait]
99-
impl ActiveModelBehavior for ActiveModel {
100-
async fn after_save<C>(model: Model, db: &C, insert: bool) -> Result<Model, DbErr>
101-
where
102-
C: ConnectionTrait,
103-
{
104-
if insert {
105-
let collection = Collection::find_by_id(model.collection_id)
106-
.one(db)
107-
.await?
108-
.unwrap();
109-
associate_user_with_entity(
110-
&collection.user_id,
111-
model.metadata_id,
112-
model.person_id,
113-
model.exercise_id.clone(),
114-
model.metadata_group_id,
115-
db,
116-
)
117-
.await
118-
.ok();
119-
}
120-
Ok(model)
121-
}
122-
}
93+
impl ActiveModelBehavior for ActiveModel {}

apps/backend/src/entities/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
1+
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15
22
33
pub mod prelude;
44

@@ -19,5 +19,6 @@ pub mod review;
1919
pub mod seen;
2020
pub mod user;
2121
pub mod user_measurement;
22+
pub mod user_to_collection;
2223
pub mod user_to_entity;
2324
pub mod workout;

apps/backend/src/entities/prelude.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6
1+
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15
22
33
pub use super::calendar_event::Entity as CalendarEvent;
44
pub use super::collection::Entity as Collection;
@@ -17,5 +17,6 @@ pub use super::review::Entity as Review;
1717
pub use super::seen::Entity as Seen;
1818
pub use super::user::Entity as User;
1919
pub use super::user_measurement::Entity as UserMeasurement;
20+
pub use super::user_to_collection::Entity as UserToCollection;
2021
pub use super::user_to_entity::Entity as UserToEntity;
2122
pub use super::workout::Entity as Workout;

0 commit comments

Comments
 (0)