Commit Graph

1002 Commits

Author SHA1 Message Date
shockrah
93ad507e4e * Exposing rtc::notify to avoid single use functions
This  also avoid sthe issue of rustc not inling these functions leaving us with more jump than we need
2021-06-12 23:07:25 -07:00
shockrah
634461c591 + First pass of rtc notifications
* Some tests need to happen in order to ensure correct behavior
2021-06-12 23:06:40 -07:00
shockrah
0e607eac1d -* Removing ugle tuple indexing with some cleaner binds
- Removing warning of unused var
+ Adding 404 response to /badge/update/name when the badge_id isn't real
2021-06-07 23:57:41 -07:00
shockrah
b289f5c811 * Fixing /badge/update/name parameters for basic test
Basically we weren't sending the right data to prompt a 200 response

!!! the /badge/delete test is breaking previous tests idk why
Even though this test comes close to last it still manages to break
the tests that come before it. The problem may lie with the fact that
because its a much faster route by design that its e2e latency btfo's
the routes before it, allowing it to finish before they do.
This likely causes a race condition.
2021-06-07 23:53:49 -07:00
shockrah
d3eddce81f * Fixing typo which broke test behavior 2021-06-07 22:47:44 -07:00
shockrah
ecb55fa4fe * /badge/update/perms {perms} param is now {badge_perms}
This makes the parameter follow the naming convention of badge_*

* badges.id field now uses BIGINT's as intended

* Typo in sql where 'badges' was incorrectly set to 'perms' -_-
2021-06-07 22:42:26 -07:00
shockrah
fa89088094 + Adding new badges tests
! Test bot is once again a massive disaster but at least it scales well /shrug
Should probably refactor test bot to be moar straight forward or something idk

+ Also adding some spacing eye candy to make sure we can read things easily
2021-06-07 22:33:53 -07:00
shockrah
b7c7b8b5e8 * Moving a cloned channel into rtc:channel_create call 2021-06-07 19:37:16 -07:00
shockrah
0e6168a961 + Adding API handlers for /badge/update/* routes
* Fixing permissions for routes
The /badge/update routes all share the same perms for now
2021-05-30 19:54:20 -07:00
shockrah
1884580bf8 * Simplified badge structure
+ Adding driver code for backend update methods
This is basically all the dblib code required for the differing /badge/update/* api handlers to use
2021-05-30 19:49:48 -07:00
shockrah
e754b18687 + Adding hooks for /badge/update/* routes
! /badge/update/* routes have been split into */name|color|perms
2021-05-30 19:35:14 -07:00
shockrah
2d1f9a37db + First pass of db backend and API handlers for badges module
It should be noted that /badge/update needs some more planning so 1 more commit
is justified for it as some consideration must be taken for how individual badge
permissions are going to be handled
2021-05-29 19:13:13 -07:00
shockrah
4352c840ac + Adding Badges API route hooks
! POST /badge/new
! DELETE /badge/delete
! PUT /badge/update
! GET /badge/list
2021-05-29 19:06:43 -07:00
shockrah
37eeb3877c - Removing rtc parts for th pure api testing
This does mean we're going to have to rebuild for API + RTC testing but its ok
because the two are wholey different feature sets anway
2021-05-29 14:35:13 -07:00
shockrah
4c0888a263 * /message/recent no longer uses unwraps
This should make it way safer
2021-05-29 14:23:47 -07:00
shockrah
32dbbe11eb * Fixing /channel/create response body
Now it always returns a json structure where before only the rtc branch was
doing this.
2021-05-29 14:22:24 -07:00
shockrah
928c6336d3 * Fixing some of the /message/send API hits by including all required match branches
Some tests are still failing however and I have no idea why
2021-05-27 23:17:47 -07:00
shockrah
0b34c25477 * Fixing broken /channels/create due to updated channel structure
The badges_id field has proved to bubble up some issues with updating deep structures
Basically this just means that feature branches for deep features like this are a good idea

! Issue: RTC feature flag was working fine but without the feature flag `Row`'s had no pickup
This meant correct responses were slipping into previously unreachable sections of code
2021-05-26 12:14:43 -07:00
shockrah
990ad347f7 * Change join route to just /join 2021-05-26 12:08:55 -07:00
shockrah
03f6624943 * Default values for badge_ids in channels & members 2021-05-20 16:44:30 -07:00
shockrah
a2f8cfb09d + Adding badge_ids to db-lib backend
With this frontend points now return proper data  structures which of course contain
badge_id vectors

Along with defaulting to '[]' strings in  mysql configuration serde_json  calls
now fallback to .unwrap_or(Vec::new()) for cheapish callbacks.
These fallback calls are cheap because Vec::new doesn't allocate anything on the heap
because they're empty.
2021-05-20 16:44:08 -07:00
shockrah
fc24ad3430 * Badges now have an optional permissions field
* New struct changes integrating badge system
2021-05-17 16:04:26 -07:00
shockrah
36dbc8dd1e + Badges introduction to database schemas
+ Adding some default empty list values where applicable
neighbors now has a default value of '[]' to enforce the "empty list" constraint on that field
2021-05-17 15:50:53 -07:00
shockrah
e5e0875037 * Moving rtc calls to build under rtc feature flag
- Marking additional goal met on roadmap

The current build model succesfully builds rtc enabled/disabled builds
2021-05-17 14:49:01 -07:00
shockrah
4e737d4292 + Seperating slim & rtc builds in makefile 2021-05-17 14:44:56 -07:00
shockrah
1edab53778 * Fixing issue where a rougue popd broke the whole job 2021-05-12 16:19:41 -07:00
shockrah
f952b91a32 - Removing broken build job build-json-api
Issue seemed to be that artifacts were not being preserved properly.
This was causing failures in test stages where it was basicallly impossible to debug
"real" issues

- Removing artifacting (json-api) for now
They'll be re-added when there's a good way of verifying the quality of builds.
For now they're gone because the mock test stage is doing a lot of work already

+ mock-test job now builds json-api
This fixes the first issue this patches intends on fixing however it's kinda
cheesy and should probably be replaced at some point with a better fix
2021-05-12 16:04:58 -07:00
shockrah
7ae975e7c1 ! Finsihed goal on roadmap
! Finished docs on new update from roadmap
/neighbors/ api is now fully doc'd however we still need some rtc integration
2021-05-12 15:00:39 -07:00
shockrah
cfbee6d887 ! This merge denotes the MVP completion for the backend decentralization endpoints
More routes are to be added in the future but for now this should suffice

Doc's are now required and the roadmap need to be updated as well
2021-05-12 14:27:34 -07:00
shockrah
c25e8047cf + Finishing up more tests for the /neighbors routes
For now this sub api is at an mvp stage so it should be fine to move onto new
features after this point for now.
2021-05-12 14:22:14 -07:00
shockrah
24b5f11b13 * Better logging in meta module(more logging tags) 2021-05-12 14:14:30 -07:00
shockrah
fbcf16b735 + Adding /neighbor/remove route api code and db-lib code
This patch has not yet been tested but will be in the coming patches

Sumamary: we're just doing a regular delete on the neighbor's table based off
the url field
2021-05-12 14:07:38 -07:00
shockrah
e94c720332 + More comprehensive testing on /neighbor/update
The cases that actually matter should be covered now so I'm confident with this
endpoint's behavior
! A preliminary db::neighbors::get is done to cover the 404 case
Basically if a bad url is used in the request we should 404 the update as there
won't be anything relevant to update
2021-05-12 13:05:52 -07:00
shockrah
8bff61ab71 * Fixed issue where put requests weren't firing with the optional body parameter
This also "fixes" the /neighbor/update route conveniently enough, which had much
better behavior than expected before.

- Remvoing some fluff from debugging
2021-05-12 13:02:42 -07:00
shockrah
a0d60c0568 - Pointless permissions check /message/send handler
Auth module literally does this for us see: auth::valid_perms
2021-05-11 17:27:04 -07:00
shockrah
a941165ea5 + adding /neighbor/update route to dispatch
! This route needs way more testing as its currently failing the prelim test listed right now

! Some more misc changes in testing/mod.rs that aren't imporant at all to anyone
It's just an extra comment
2021-05-11 17:25:51 -07:00
shockrah
1ca17ec6e0 * /neighbor/add handler now uses body for neighbor structure data
This chage is basically required due to the ridiculuous number of parameters that needed to be passed.
Also more POC for showing how serde_json's result type can be used to safely parse http bodies
2021-05-11 17:23:15 -07:00
shockrah
666894af0e + Debug to Neighbor struct
* add_neighbor now takes a moved Neighbor param instead of the fields individually
This should make it a easier for both front & backend to parse what's happening.
It also let's us leveraege serde_json a bit more
2021-05-11 17:18:17 -07:00
shockrah
664b837f13 + More tests for /neighbor routes
! put /neighbor/update is failing due to a failure to parse the body correctly on thebackend
Further investigation is required

+ Kinda minor but I'm also adding the ability to `put` things now
+ Also an if statement to avoid failing on checkf for NoneType responses
2021-05-11 17:16:50 -07:00
shockrah
b4c55b72ea - Removing unused .env file
diesel still requires this however the --database-url flag is there to alleviate this issue
+ make test now cleans up fake png images from the cwd
This is more for comfort reall
2021-05-11 17:14:22 -07:00
shockrah
45540ddd25 * Better failure logging in failed requests
self.passing property is a much more comprehensive way of checking for passing tests
Also this uses the colors to dump to stdout
2021-05-11 15:22:56 -07:00
shockrah
b810a5abba * Fixing message body unwrap to safer unwrap_or
unwrap had a chance to panic where as the unwrap_or now defaults to an empty
Bytes object which lets the code after it fail with an HTTP 400. This is preferrable
to a 500 error as there really is no error, just bad/unpollable input from the
end user.
2021-05-11 13:52:07 -07:00
shockrah
f1b1581588 + db::neighbors::get and db::neighbors::update
It should be noted at this point we're considering url's as the "primary key"
even though its kinda weird to use them that way.
Even though a varchar primary key doesn't really scale well I'm considering it
fine for now as the neighbors table is controlled by admins(by hand) and hopefully
won't need to scale.
2021-05-11 13:45:41 -07:00
shockrah
83f846640c - Removing unused .env files
Opting now for config.json files as they better interoperability between node and rust

+ Hardcoding some variables into build-db.sh
This really shouldn't be an issue however

+ using cat to dump out what table structures are being setup due to strange bugs in pipeline
2021-05-10 15:58:57 -07:00
shockrah
96bdd70cd5 + MOre comprehensive logs from subprocess in create_admin 2021-05-10 13:59:10 -07:00
shockrah
a448273bf2 Merging roadmap to master early for clarity sake 2021-05-09 23:20:47 -07:00
shockrah
ee5d9fb248 + Better formatting in hyper compact code
+ Adding ADD_NEIGHBOR permissions flag
2021-05-09 23:16:43 -07:00
shockrah
b3c27b86ce * Fixing some json serialization/parsing weirdness in the meta::BASIC_CONFIG initialization
This is part of a bigger change to stop using environment variables around as state as its mega cheese
2021-05-09 23:15:09 -07:00
shockrah
adc5b261e8 + ADD_NEIGHBOR route now supported in API backend
! Requiring a special event in the RTC server docs for this change
2021-05-09 23:14:02 -07:00
shockrah
c443b9bb07 + More tests for the /neighbor/add and /neighbor/list routes
These are baseline tests however a new /neighbor/remove & /neighbor/edit route should be edited before I call this done on the roadmap.
Also some more intense testing around these current routes is required.
Mostly because the expectation that JSON is being sent  to us in /neighbor/add
It could be worth the effort to send this data as json in the body
! Currently parameters are sent via the query string is in line with how most routes behave
For this route is just feels weird dealing with al the issues with json in the query string
2021-05-09 23:11:51 -07:00