Skip to content

Commit

Permalink
show completed articles (#19)
Browse files Browse the repository at this point in the history
* wip - creating next buttons for articles

* wip marking user articles as started

* marking user article complete when hitting the button

* marking articles as completed at load

* wip - marking the completed articles completed live and not just in database. Probably need to do an upsert or something else

* marking articles as started and completed at the right times

* fixed errors and warningsO

* using latest ycl

* fixed clippy warnings

* running cargo check only on this library

* fixing bug due to futursolo/stylist-rs#120

* using an older version of rust

* fixed cargo formatting problem

* fixed cargo formatting problem
  • Loading branch information
BrooksPatton authored Jun 15, 2023
1 parent d5d1f40 commit 016e102
Show file tree
Hide file tree
Showing 16 changed files with 3,741 additions and 219 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: 1.69.0
components: rustfmt, clippy
- name: cargo check
run: touch .env && cargo check
run: touch .env && cargo check --lib
env:
RUST_ENV: test
GRAPHQL_URI: http://localhost:8081
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
yew = { version = "0.20.0", features = ["csr"] }
ycl = { git = "https://github.com/brooks-builds/ycl", rev = "c01c7f6" }
ycl = { git = "https://github.com/brooks-builds/ycl", rev = "79d332c" }
# ycl = { path = "../ycl/" }
yew-router = "0.17.0"
gloo = "0.8.0"
Expand All @@ -26,3 +26,6 @@ stylist = { version = "0.12.0", features = ["yew"] }
url = "2.3.1"
wasm-bindgen-futures = "0.4.34"
eyre = "0.6.8"

[profile.dev.package.wasm-bindgen]
debug-assertions = false
5 changes: 5 additions & 0 deletions database/mutations/api_complete_user_article.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mutation ApiCompleteUserArticle($user_id: Int!, $article_id: Int!) {
update_user_articles(where: {user_id: {_eq: $user_id}, article_id: {_eq: $article_id}}, _set: {completed_at: "NOW()"}) {
affected_rows
}
}
6 changes: 6 additions & 0 deletions database/mutations/api_insert_user_article.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mutation ApiInsertUserArticle($user_id: Int!, $article_id: Int!) {
insert_user_articles_one(object: {article_id: $article_id, user_id: $user_id}) {
article_id
user_id
}
}
4 changes: 4 additions & 0 deletions database/queries/get_all_courses.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ query ApiGetAllData {
id
}
}
articles {
article_id
completed_at
}
}
}
Loading

0 comments on commit 016e102

Please sign in to comment.