Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5646 item direction table #5752

Merged
merged 8 commits into from
Dec 12, 2024
Merged

5646 item direction table #5752

merged 8 commits into from
Dec 12, 2024

Conversation

Chris-Petty
Copy link
Contributor

Fixes #5646

πŸ‘©πŸ»β€πŸ’» What does this PR do?

Adds migration, repo and sync logic for the item direction table

@github-actions github-actions bot added this to the v2.5.0 milestone Dec 11, 2024
@github-actions github-actions bot added Team Piwakawaka James, Carl, John, Zachariah feature: dispensing labels Dec 11, 2024
@Chris-Petty Chris-Petty requested review from a team, CarlosNZ and jmbrunskill and removed request for a team December 11, 2024 02:59
Copy link
Contributor

@jmbrunskill jmbrunskill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Chris, seems to be working well for me!

Couple of comments up to you if you want to address them...


#[derive(Clone, Default, PartialEq, Debug)]
pub struct ItemDirectionFilter {
pub id: Option<EqualFilter<String>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're going to want a filter on item_id, could be done later though, so I'm happy if it's not in this PR.

id TEXT NOT NULL PRIMARY KEY,
item_link_id TEXT NOT NULL REFERENCES item_link(id),
directions TEXT NOT NULL,
priority BIGINT NOT NULL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have thought INTEGER would be ok, I guess big int is fine too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had integer and diesel postgres was throwing a wobbly on i64 not receiving enough bytes


let result = ItemDirectionRow {
id: data.ID,
item_link_id: data.item_ID,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to assume an item_id is also an item_link_id? Feels like we might need to look up the item_id based on this, but then I always get confused with *_link tables...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The item link tables are populated with item.id == item_link.id == item.item_link_id so it should be fine I think!

Clone, Insertable, Queryable, Debug, PartialEq, AsChangeset, Eq, Serialize, Deserialize,
)]
#[diesel(table_name = item_direction)]
#[diesel(treat_none_as_null = true)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is a little bit pointless with no nullable columns :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cargo cult πŸ˜†

@Chris-Petty Chris-Petty merged commit 20f5074 into develop Dec 12, 2024
3 checks passed
@Chris-Petty Chris-Petty deleted the 5646-item-direction-table branch December 12, 2024 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: dispensing Team Piwakawaka James, Carl, John, Zachariah
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create & sync Item Directions Table
2 participants