Generally more explicit behavior is provided
*NOTE: if this call succeeds then we have fully authenticated and subsequent calls should have acccess to "secret" in the serialized params structure, thus unwraps should be fine as they'll be proven via informal induction
* channels schema now uses a bigint unsigned for pid
this is to keep consistent with notion of id's being usize|u64 in rust
* foreign key constraint added to keys table referencing user rows
Why: The idea is that writing a body parser is both really annoying and not really optimal
At this time I need some way of getting body params easily while endpionts are tested
at some point we'll come up with a smaller footprint way of parsing http parameters
Ideally one that also comes with the ability to combine parameters but,
for now using serde_json suffices.
InviteRow now has some utilities built into it to help with translating values from various types needed throughout the codebase
+from_tuple -> because mysql is used to grab tuples before structs
+as_json_str -> because we respond primarily with json payloads
list_channels is considered a main entry point from the dispather and thus handles errors itself
this lets us cut down on worrying about mysql errors
Mysql error responsibility is now the route dispatchers problem
Route dispatcher itself can easily dispatch to another handler
+ new() -> create a new ready to insert invite
+ from_tuple -> helps us translate db responses into a struct
+ as_json_str -> String which we can use as a json payload(jank but whatever it works with proper headers)
FUnctions:
get_invite_by_code: as the name implies grabs an invite assuming its in our db otherwise None
record_invite_usage: blindly modifies the row in the schema, assumes that if we get to this point we're ok to ignore erroneous possibilities
join_invite_code: main dispatcher for joining using the /invite/join route
create_invite: meant to the be the route handler for creating invites later on
Needed: test module since we've basically reworked the whole auth/invite system in one day
route dispatcher work begins with dispatching to invites::join_invite_code
Fixed the non mutable ref borrowing in funcs that required mutable references like most that get called by route_dispatcher