Closed insertish closed 3 months ago
Just added a presence
crate to core with a unit test covering the whole crate.
Found one issue with how I was handling flags in the mean time and that's been fixed now.
Overall progress for porting models:
core/database
.core/models/[..]/v0
.moved to OP
delta now no longer uses quark and only relies on core crates bonfire TODO (but it'll be a much faster and smaller job)
this took a year :clueless:
So I've done a bunch of design work around the architecture / strategy and ended up with a nice solution for developing the backend going forwards which I'll get into below.
First of all, the main driving motivations behind this are to:
There are a couple conditions with this refactor though:
So, here's what's changed:
rocket::State<revolt_database::Database>
for any new database model operations.revolt_result::Error
type, do it as such:Your errors should now look like:
.into()
or the appropriate function if more than one object is required from the database!There are also some things that need to be sorted out still:
revolt-result
crate to be MITrevolt-models
crate to "be MIT" (withoutfrom_database
feature) or "MIT / AGPL" (withfrom_database
feature) I'd need to read up a bit on this and check if I need to do anything special here with how Cargo dependencies work, in theory I should just need to add a notice that whilerevolt-models
itself is MIT, it has an optional dependency to an AGPL licensed crate.You can read the new code on the refactor/split-project-into-core-crates branch (which will be merged in the near future). These changes will also be used to test #210 (webhooks) before it is merged in.
Future plans:
_id
in favour ofid
or introducing a better system for remvoing fields such as sending empty strings. As mentioned earlier, we could provide a "v1" and "v2" API endpoint to avoid disruption since database models would be separate.Note: If I forgot something, I'll edit the post and also mention it in the comments that it's changed.
Remaining models and implementations:
Other issues to tackle: