-
Notifications
You must be signed in to change notification settings - Fork 1
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
[NO-ISSUE] feat: allow to query multiple users (freebusy) #26
[NO-ISSUE] feat: allow to query multiple users (freebusy) #26
Conversation
…d-integration-test-for-our-use-cases
…' into guillaume/feat/add-format-lint-via-biome
…e/refactor/convert-unix-timestamps-to-datetimes
…low query metadata
…' into guillaume/feat/add-js-docs-client-lib
…eat/allow-to-query-free-busy-multiple
@@ -1,4 +1,5 @@ | |||
export DATABASE_URL := "postgresql://postgres:postgres@localhost:45432/nettuscheduler" | |||
export RUST_BACKTRACE := "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print backtrace in case of error
# Run the migrations | ||
cd crates/infra && sqlx migrate run && cd ../.. | ||
|
||
# Run the tests | ||
cargo nextest run --workspace && cd .. | ||
cargo test --workspace && cd .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the tests should be run sequentially per crate as the DB instance is shared (nextest run all crates in parallel), so for the moment I revert back to cargo test
(default test runner)
return { | ||
res: res.res, | ||
status: res.status, | ||
data: { | ||
busy: res.data.busy.map(convertInstanceDates), | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix, it should retun Date
s and not strings
@@ -380,12 +380,230 @@ describe('Requirements', () => { | |||
it.todo('To be implemented') | |||
}) | |||
|
|||
describe("Users' calendars can be queried in groups", () => { | |||
it.todo('To be implemented') | |||
describe('Multiple calendars of the same user can be queried at once', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not linked to the new feature of querying on multiple users for freebusy, but worth adding
}) | ||
|
||
describe("Users' availability can be queried in groups", () => { | ||
it.todo('To be implemented') | ||
describe('Multiple calendars of different users can be queried at once', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is freebusy of multiple users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Satisfying PR! Some questions.
userIds: UUID[] | ||
/** | ||
* Start time of the period to check for freebusy | ||
* @format Date in UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you've thought of this so maybe just catch me up, but:
my expectation as a user of the client would be that I'd be able to query with timezone information, this seems like the main place someone would make a mistake there.
Is there a reason why this expects UTC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have started looking into a bit more in #28, following the article that Derek shared, but it's a bit more complex than expected (I need to invest more time).
Ideally, I would like (at least) the JS SDK, the Rust SDK and the API to accept any timezone.
The API could still only handle only UTC datetimes internally. In the PR above, I've tried to have timezones everywhere (so, never convert to UTC, but it became quite complex so I decided to focus on the other requirements as this one is not blocking per se
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for me, we might need to revisit the API design later though.
The reason I ask is you're going to immediately have this problem I think since we're operating in Tokyo timezone.
} | ||
} | ||
|
||
#[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it idiomatic to put the test in the same file in Rust?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends:
- it's idiomatic to have unit tests in the same file
- it's idiomatic to have integration tests in a specific "tests" directory
It's worth noting that having unit tests in the same file allows to access private functions, structs, etc., of that module (as the tests are effectively inside the module)
(source)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL! I like that actually.
userIds: UUID[] | ||
/** | ||
* Start time of the period to check for freebusy | ||
* @format Date in UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for me, we might need to revisit the API design later though.
The reason I ask is you're going to immediately have this problem I think since we're operating in Tokyo timezone.
*/ | ||
busy: CalendarEventInstance[] | ||
[key: string]: CalendarEventInstance[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Shouldn't this be key: UUID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GuillaumeDecMeetsMore minor nit, otherwise LGTM.
} | ||
} | ||
|
||
#[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL! I like that actually.
Changed