You've already forked AstralRinth
forked from didirus/AstralRinth
Add redis caching to getting user notifications and projects [MOD-540] (#723)
* Add redis caching to getting a user's project ids * Run `cargo sqlx prepare` to update the sqlx-data.json * Add redis caching for getting user notifications * Fix new clippy warnings * Remove log that shouldn't have been committed * Batch insert of notifications (untested) * sqlx prepare... * Fix merge conflict things and use new redis struct * Fix bug with calling delete_many without any elements (caught by tests) * cargo sqlx prepare * Add tests around cache invalidation (and fix bug they caught!) * Some test reorg based on code review suggestions
This commit is contained in:
@@ -92,14 +92,10 @@ pub async fn notifications_scopes() {
|
||||
|
||||
// We will invite user 'friend' to project team, and use that as a notification
|
||||
// Get notifications
|
||||
let req = TestRequest::post()
|
||||
.uri(&format!("/v2/team/{alpha_team_id}/members"))
|
||||
.append_header(("Authorization", USER_USER_PAT))
|
||||
.set_json(json!( {
|
||||
"user_id": FRIEND_USER_ID // friend
|
||||
}))
|
||||
.to_request();
|
||||
let resp = test_env.call(req).await;
|
||||
let resp = test_env
|
||||
.v2
|
||||
.add_user_to_team(alpha_team_id, FRIEND_USER_ID, USER_USER_PAT)
|
||||
.await;
|
||||
assert_eq!(resp.status(), 204);
|
||||
|
||||
// Notification get
|
||||
@@ -164,14 +160,10 @@ pub async fn notifications_scopes() {
|
||||
|
||||
// Mass notification delete
|
||||
// We invite mod, get the notification ID, and do mass delete using that
|
||||
let req = test::TestRequest::post()
|
||||
.uri(&format!("/v2/team/{alpha_team_id}/members"))
|
||||
.append_header(("Authorization", USER_USER_PAT))
|
||||
.set_json(json!( {
|
||||
"user_id": MOD_USER_ID // mod
|
||||
}))
|
||||
.to_request();
|
||||
let resp = test_env.call(req).await;
|
||||
let resp = test_env
|
||||
.v2
|
||||
.add_user_to_team(alpha_team_id, MOD_USER_ID, USER_USER_PAT)
|
||||
.await;
|
||||
assert_eq!(resp.status(), 204);
|
||||
let read_notifications = Scopes::NOTIFICATION_READ;
|
||||
let req_gen = || test::TestRequest::get().uri(&format!("/v2/user/{MOD_USER_ID}/notifications"));
|
||||
|
||||
Reference in New Issue
Block a user