Skip to content
This repository was archived by the owner on Oct 12, 2026. It is now read-only.

Commit 1700884

Browse files
committed
feat: provide RelatedCards support
1 parent c970b72 commit 1700884

42 files changed

Lines changed: 1036 additions & 805 deletions

Some content is hidden

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

‎Justfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ latest_tag:
1515

1616
# Starts the Claude container
1717
claude:
18-
docker compose -f dev/docker-compose.yml up --build --detach
18+
docker compose -f dev/docker-compose.dev.yml up --build --detach
1919

2020
# Tear down the Claude container
2121
claude-down:

‎bun.lock‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dev/Dockerfile‎

Lines changed: 0 additions & 20 deletions
This file was deleted.

‎dev/docker-compose.dev.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
claude:
3+
image: 'ghcr.io/leoborai/docker-claude:41b6bb4'
4+
volumes:
5+
- ../:/workspaces/dev
6+
- claude:/root/.claude
7+
command: sleep infinity
8+
stdin_open: true
9+
tty: true
10+
11+
volumes:
12+
claude:

‎dev/docker-compose.yml‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎src/domain/src/mtg/service.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct FindCardsFilter {
1515
pub deck_id: Option<Uuid>,
1616
pub unique: Option<bool>,
1717
pub title: Option<String>,
18+
pub skip: Option<Uuid>,
1819
pub page: Option<u32>,
1920
}
2021

‎src/server/src/modules/mtg/repository.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ impl MtgDataAccessLayer for MtgRepository {
155155
async fn find_cards(&self, filter: FindCardsFilter) -> Result<QuerySet<Card>> {
156156
let mut conn = self.db.acquire().await?.detach();
157157
let page = filter.page.unwrap_or(0);
158+
let cols = if filter.unique.unwrap_or(false) {
159+
[Cards::DeckId]
160+
} else {
161+
[Cards::Id]
162+
};
158163
let (sql, values) = Query::select()
159164
.columns([
160165
Cards::Id,
@@ -176,10 +181,11 @@ impl MtgDataAccessLayer for MtgRepository {
176181
.deck_id
177182
.map(|deck_id| Expr::col(Cards::DeckId).eq(deck_id.to_string())),
178183
)
184+
.and_where_option(filter.skip.map(|skip| Expr::col(Cards::Id).is_not(skip)))
179185
.and_where_option(filter.title.map(|title| {
180186
Expr::col(Cards::Title).like(format!("%{}%", title.replace('%', "\\%")))
181187
}))
182-
.group_by_col(Cards::DeckId)
188+
.group_by_columns(cols)
183189
.limit(PAGE_SIZE)
184190
.build_sqlx(SqliteQueryBuilder);
185191

‎src/server/src/router/api/v0/mtg/retrieve_cards.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ pub async fn handler(
3333
let cards_qs = services
3434
.mtg
3535
.get_cards(FindCardsFilter {
36-
deck_id: None,
36+
deck_id: filter.deck_id,
3737
id: filter.id,
3838
title: filter.title,
3939
unique: filter.unique,
4040
page: page.into(),
41+
skip: filter.skip,
4142
})
4243
.await
4344
.map_err(|err| {
@@ -62,4 +63,12 @@ pub struct FindCardsParams {
6263
/// Whether to group by Deck ID
6364
#[param(example = "true")]
6465
pub(self) unique: Option<bool>,
66+
/// Deck ID to filter cards by
67+
#[param(example = "ac0dbd6e-4c71-5d7b-a96a-8bd1d7908326")]
68+
pub(self) deck_id: Option<Uuid>,
69+
/// UUIDs for Cards to Skip
70+
#[param(
71+
example = "2504cb4b-292f-5dd8-8c9e-6e805500454d, ac0dbd6e-4c71-5d7b-a96a-8bd1d7908326"
72+
)]
73+
pub(self) skip: Option<Uuid>,
6574
}

‎src/ui/.prettierignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore artifacts:
2+
build
3+
coverage

‎src/ui/.prettierrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)