@aurora-interactive/sensei-productivity 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/commonjs/funcs/categories-create.d.ts +1 -1
- package/dist/commonjs/funcs/categories-create.d.ts.map +1 -1
- package/dist/commonjs/funcs/categories-create.js +3 -2
- package/dist/commonjs/funcs/categories-create.js.map +1 -1
- package/dist/commonjs/funcs/categories-delete.js +2 -2
- package/dist/commonjs/funcs/categories-delete.js.map +1 -1
- package/dist/commonjs/funcs/categories-get-all.d.ts +1 -1
- package/dist/commonjs/funcs/categories-get-all.d.ts.map +1 -1
- package/dist/commonjs/funcs/categories-get-all.js +3 -2
- package/dist/commonjs/funcs/categories-get-all.js.map +1 -1
- package/dist/commonjs/funcs/categories-update.d.ts +1 -1
- package/dist/commonjs/funcs/categories-update.d.ts.map +1 -1
- package/dist/commonjs/funcs/categories-update.js +3 -2
- package/dist/commonjs/funcs/categories-update.js.map +1 -1
- package/dist/commonjs/funcs/schools-get-all.js +2 -2
- package/dist/commonjs/funcs/schools-get-all.js.map +1 -1
- package/dist/commonjs/funcs/schools-get.d.ts +1 -1
- package/dist/commonjs/funcs/schools-get.d.ts.map +1 -1
- package/dist/commonjs/funcs/schools-get.js +3 -2
- package/dist/commonjs/funcs/schools-get.js.map +1 -1
- package/dist/commonjs/funcs/users-activities-create.d.ts +1 -1
- package/dist/commonjs/funcs/users-activities-create.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-activities-create.js +3 -2
- package/dist/commonjs/funcs/users-activities-create.js.map +1 -1
- package/dist/commonjs/funcs/users-activities-delete.js +2 -2
- package/dist/commonjs/funcs/users-activities-delete.js.map +1 -1
- package/dist/commonjs/funcs/users-activities-get-all-of-user.d.ts +1 -1
- package/dist/commonjs/funcs/users-activities-get-all-of-user.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-activities-get-all-of-user.js +3 -2
- package/dist/commonjs/funcs/users-activities-get-all-of-user.js.map +1 -1
- package/dist/commonjs/funcs/users-activities-get.d.ts +1 -1
- package/dist/commonjs/funcs/users-activities-get.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-activities-get.js +3 -2
- package/dist/commonjs/funcs/users-activities-get.js.map +1 -1
- package/dist/commonjs/funcs/users-activities-me.d.ts +1 -1
- package/dist/commonjs/funcs/users-activities-me.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-activities-me.js +3 -2
- package/dist/commonjs/funcs/users-activities-me.js.map +1 -1
- package/dist/commonjs/funcs/users-activities-update.d.ts +1 -1
- package/dist/commonjs/funcs/users-activities-update.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-activities-update.js +3 -2
- package/dist/commonjs/funcs/users-activities-update.js.map +1 -1
- package/dist/commonjs/funcs/users-delete.js +2 -2
- package/dist/commonjs/funcs/users-delete.js.map +1 -1
- package/dist/commonjs/funcs/users-friends-accept.d.ts +14 -0
- package/dist/commonjs/funcs/users-friends-accept.d.ts.map +1 -0
- package/dist/commonjs/funcs/users-friends-accept.js +127 -0
- package/dist/commonjs/funcs/users-friends-accept.js.map +1 -0
- package/dist/commonjs/funcs/users-friends-list.d.ts +14 -0
- package/dist/commonjs/funcs/users-friends-list.d.ts.map +1 -0
- package/dist/commonjs/funcs/users-friends-list.js +128 -0
- package/dist/commonjs/funcs/users-friends-list.js.map +1 -0
- package/dist/commonjs/funcs/users-friends-pending.d.ts +14 -0
- package/dist/commonjs/funcs/users-friends-pending.d.ts.map +1 -0
- package/dist/commonjs/funcs/users-friends-pending.js +113 -0
- package/dist/commonjs/funcs/users-friends-pending.js.map +1 -0
- package/dist/commonjs/funcs/users-friends-reject.d.ts +14 -0
- package/dist/commonjs/funcs/users-friends-reject.d.ts.map +1 -0
- package/dist/commonjs/funcs/users-friends-reject.js +127 -0
- package/dist/commonjs/funcs/users-friends-reject.js.map +1 -0
- package/dist/commonjs/funcs/users-friends-remove.d.ts +14 -0
- package/dist/commonjs/funcs/users-friends-remove.d.ts.map +1 -0
- package/dist/commonjs/funcs/users-friends-remove.js +127 -0
- package/dist/commonjs/funcs/users-friends-remove.js.map +1 -0
- package/dist/commonjs/funcs/users-friends-send-request.d.ts +14 -0
- package/dist/commonjs/funcs/users-friends-send-request.d.ts.map +1 -0
- package/dist/commonjs/funcs/users-friends-send-request.js +127 -0
- package/dist/commonjs/funcs/users-friends-send-request.js.map +1 -0
- package/dist/commonjs/funcs/users-get.d.ts +1 -1
- package/dist/commonjs/funcs/users-get.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-get.js +3 -2
- package/dist/commonjs/funcs/users-get.js.map +1 -1
- package/dist/commonjs/funcs/users-login.d.ts +1 -1
- package/dist/commonjs/funcs/users-login.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-login.js +3 -2
- package/dist/commonjs/funcs/users-login.js.map +1 -1
- package/dist/commonjs/funcs/users-me.d.ts +1 -1
- package/dist/commonjs/funcs/users-me.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-me.js +3 -2
- package/dist/commonjs/funcs/users-me.js.map +1 -1
- package/dist/commonjs/funcs/users-posts-delete.js +2 -2
- package/dist/commonjs/funcs/users-posts-delete.js.map +1 -1
- package/dist/commonjs/funcs/users-posts-feed.d.ts +1 -1
- package/dist/commonjs/funcs/users-posts-feed.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-posts-feed.js +4 -3
- package/dist/commonjs/funcs/users-posts-feed.js.map +1 -1
- package/dist/commonjs/funcs/users-posts-get-by-post-id.d.ts +1 -1
- package/dist/commonjs/funcs/users-posts-get-by-post-id.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-posts-get-by-post-id.js +3 -2
- package/dist/commonjs/funcs/users-posts-get-by-post-id.js.map +1 -1
- package/dist/commonjs/funcs/users-posts-get-by-user-id.d.ts +1 -1
- package/dist/commonjs/funcs/users-posts-get-by-user-id.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-posts-get-by-user-id.js +3 -2
- package/dist/commonjs/funcs/users-posts-get-by-user-id.js.map +1 -1
- package/dist/commonjs/funcs/users-posts-update.d.ts +1 -1
- package/dist/commonjs/funcs/users-posts-update.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-posts-update.js +3 -2
- package/dist/commonjs/funcs/users-posts-update.js.map +1 -1
- package/dist/commonjs/funcs/users-signup.d.ts +1 -1
- package/dist/commonjs/funcs/users-signup.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-signup.js +3 -2
- package/dist/commonjs/funcs/users-signup.js.map +1 -1
- package/dist/commonjs/funcs/users-update.d.ts +1 -1
- package/dist/commonjs/funcs/users-update.d.ts.map +1 -1
- package/dist/commonjs/funcs/users-update.js +3 -2
- package/dist/commonjs/funcs/users-update.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +4 -4
- package/dist/commonjs/lib/config.js +4 -4
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/lib/matchers.d.ts.map +1 -1
- package/dist/commonjs/lib/matchers.js +0 -1
- package/dist/commonjs/lib/matchers.js.map +1 -1
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js +1 -2
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/models/operations/accept-friend-request.d.ts +15 -0
- package/dist/commonjs/models/operations/accept-friend-request.d.ts.map +1 -0
- package/dist/commonjs/models/operations/accept-friend-request.js +49 -0
- package/dist/commonjs/models/operations/accept-friend-request.js.map +1 -0
- package/dist/commonjs/models/operations/get-feed.d.ts +3 -15
- package/dist/commonjs/models/operations/get-feed.d.ts.map +1 -1
- package/dist/commonjs/models/operations/get-feed.js +4 -15
- package/dist/commonjs/models/operations/get-feed.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +6 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +6 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/list-friends.d.ts +26 -0
- package/dist/commonjs/models/operations/list-friends.d.ts.map +1 -0
- package/dist/commonjs/models/operations/list-friends.js +65 -0
- package/dist/commonjs/models/operations/list-friends.js.map +1 -0
- package/dist/commonjs/models/operations/pending-friend-requests.d.ts +16 -0
- package/dist/commonjs/models/operations/pending-friend-requests.d.ts.map +1 -0
- package/dist/commonjs/models/operations/pending-friend-requests.js +57 -0
- package/dist/commonjs/models/operations/pending-friend-requests.js.map +1 -0
- package/dist/commonjs/models/operations/reject-friend-request.d.ts +15 -0
- package/dist/commonjs/models/operations/reject-friend-request.d.ts.map +1 -0
- package/dist/commonjs/models/operations/reject-friend-request.js +49 -0
- package/dist/commonjs/models/operations/reject-friend-request.js.map +1 -0
- package/dist/commonjs/models/operations/remove-friend.d.ts +12 -0
- package/dist/commonjs/models/operations/remove-friend.d.ts.map +1 -0
- package/dist/commonjs/models/operations/remove-friend.js +49 -0
- package/dist/commonjs/models/operations/remove-friend.js.map +1 -0
- package/dist/commonjs/models/operations/send-friend-request.d.ts +12 -0
- package/dist/commonjs/models/operations/send-friend-request.d.ts.map +1 -0
- package/dist/commonjs/models/operations/send-friend-request.js +49 -0
- package/dist/commonjs/models/operations/send-friend-request.js.map +1 -0
- package/dist/commonjs/sdk/activities.d.ts +5 -5
- package/dist/commonjs/sdk/activities.d.ts.map +1 -1
- package/dist/commonjs/sdk/categories.d.ts +3 -3
- package/dist/commonjs/sdk/categories.d.ts.map +1 -1
- package/dist/commonjs/sdk/friends.d.ts +29 -0
- package/dist/commonjs/sdk/friends.d.ts.map +1 -0
- package/dist/commonjs/sdk/friends.js +54 -0
- package/dist/commonjs/sdk/friends.js.map +1 -0
- package/dist/commonjs/sdk/posts.d.ts +4 -4
- package/dist/commonjs/sdk/posts.d.ts.map +1 -1
- package/dist/commonjs/sdk/schools.d.ts +1 -1
- package/dist/commonjs/sdk/schools.d.ts.map +1 -1
- package/dist/commonjs/sdk/users.d.ts +8 -5
- package/dist/commonjs/sdk/users.d.ts.map +1 -1
- package/dist/commonjs/sdk/users.js +4 -0
- package/dist/commonjs/sdk/users.js.map +1 -1
- package/dist/esm/funcs/categories-create.d.ts +1 -1
- package/dist/esm/funcs/categories-create.d.ts.map +1 -1
- package/dist/esm/funcs/categories-create.js +3 -2
- package/dist/esm/funcs/categories-create.js.map +1 -1
- package/dist/esm/funcs/categories-delete.js +2 -2
- package/dist/esm/funcs/categories-delete.js.map +1 -1
- package/dist/esm/funcs/categories-get-all.d.ts +1 -1
- package/dist/esm/funcs/categories-get-all.d.ts.map +1 -1
- package/dist/esm/funcs/categories-get-all.js +3 -2
- package/dist/esm/funcs/categories-get-all.js.map +1 -1
- package/dist/esm/funcs/categories-update.d.ts +1 -1
- package/dist/esm/funcs/categories-update.d.ts.map +1 -1
- package/dist/esm/funcs/categories-update.js +3 -2
- package/dist/esm/funcs/categories-update.js.map +1 -1
- package/dist/esm/funcs/schools-get-all.js +2 -2
- package/dist/esm/funcs/schools-get-all.js.map +1 -1
- package/dist/esm/funcs/schools-get.d.ts +1 -1
- package/dist/esm/funcs/schools-get.d.ts.map +1 -1
- package/dist/esm/funcs/schools-get.js +3 -2
- package/dist/esm/funcs/schools-get.js.map +1 -1
- package/dist/esm/funcs/users-activities-create.d.ts +1 -1
- package/dist/esm/funcs/users-activities-create.d.ts.map +1 -1
- package/dist/esm/funcs/users-activities-create.js +3 -2
- package/dist/esm/funcs/users-activities-create.js.map +1 -1
- package/dist/esm/funcs/users-activities-delete.js +2 -2
- package/dist/esm/funcs/users-activities-delete.js.map +1 -1
- package/dist/esm/funcs/users-activities-get-all-of-user.d.ts +1 -1
- package/dist/esm/funcs/users-activities-get-all-of-user.d.ts.map +1 -1
- package/dist/esm/funcs/users-activities-get-all-of-user.js +3 -2
- package/dist/esm/funcs/users-activities-get-all-of-user.js.map +1 -1
- package/dist/esm/funcs/users-activities-get.d.ts +1 -1
- package/dist/esm/funcs/users-activities-get.d.ts.map +1 -1
- package/dist/esm/funcs/users-activities-get.js +3 -2
- package/dist/esm/funcs/users-activities-get.js.map +1 -1
- package/dist/esm/funcs/users-activities-me.d.ts +1 -1
- package/dist/esm/funcs/users-activities-me.d.ts.map +1 -1
- package/dist/esm/funcs/users-activities-me.js +3 -2
- package/dist/esm/funcs/users-activities-me.js.map +1 -1
- package/dist/esm/funcs/users-activities-update.d.ts +1 -1
- package/dist/esm/funcs/users-activities-update.d.ts.map +1 -1
- package/dist/esm/funcs/users-activities-update.js +3 -2
- package/dist/esm/funcs/users-activities-update.js.map +1 -1
- package/dist/esm/funcs/users-delete.js +2 -2
- package/dist/esm/funcs/users-delete.js.map +1 -1
- package/dist/esm/funcs/users-friends-accept.d.ts +14 -0
- package/dist/esm/funcs/users-friends-accept.d.ts.map +1 -0
- package/dist/esm/funcs/users-friends-accept.js +91 -0
- package/dist/esm/funcs/users-friends-accept.js.map +1 -0
- package/dist/esm/funcs/users-friends-list.d.ts +14 -0
- package/dist/esm/funcs/users-friends-list.d.ts.map +1 -0
- package/dist/esm/funcs/users-friends-list.js +92 -0
- package/dist/esm/funcs/users-friends-list.js.map +1 -0
- package/dist/esm/funcs/users-friends-pending.d.ts +14 -0
- package/dist/esm/funcs/users-friends-pending.d.ts.map +1 -0
- package/dist/esm/funcs/users-friends-pending.js +77 -0
- package/dist/esm/funcs/users-friends-pending.js.map +1 -0
- package/dist/esm/funcs/users-friends-reject.d.ts +14 -0
- package/dist/esm/funcs/users-friends-reject.d.ts.map +1 -0
- package/dist/esm/funcs/users-friends-reject.js +91 -0
- package/dist/esm/funcs/users-friends-reject.js.map +1 -0
- package/dist/esm/funcs/users-friends-remove.d.ts +14 -0
- package/dist/esm/funcs/users-friends-remove.d.ts.map +1 -0
- package/dist/esm/funcs/users-friends-remove.js +91 -0
- package/dist/esm/funcs/users-friends-remove.js.map +1 -0
- package/dist/esm/funcs/users-friends-send-request.d.ts +14 -0
- package/dist/esm/funcs/users-friends-send-request.d.ts.map +1 -0
- package/dist/esm/funcs/users-friends-send-request.js +91 -0
- package/dist/esm/funcs/users-friends-send-request.js.map +1 -0
- package/dist/esm/funcs/users-get.d.ts +1 -1
- package/dist/esm/funcs/users-get.d.ts.map +1 -1
- package/dist/esm/funcs/users-get.js +3 -2
- package/dist/esm/funcs/users-get.js.map +1 -1
- package/dist/esm/funcs/users-login.d.ts +1 -1
- package/dist/esm/funcs/users-login.d.ts.map +1 -1
- package/dist/esm/funcs/users-login.js +3 -2
- package/dist/esm/funcs/users-login.js.map +1 -1
- package/dist/esm/funcs/users-me.d.ts +1 -1
- package/dist/esm/funcs/users-me.d.ts.map +1 -1
- package/dist/esm/funcs/users-me.js +3 -2
- package/dist/esm/funcs/users-me.js.map +1 -1
- package/dist/esm/funcs/users-posts-delete.js +2 -2
- package/dist/esm/funcs/users-posts-delete.js.map +1 -1
- package/dist/esm/funcs/users-posts-feed.d.ts +1 -1
- package/dist/esm/funcs/users-posts-feed.d.ts.map +1 -1
- package/dist/esm/funcs/users-posts-feed.js +4 -3
- package/dist/esm/funcs/users-posts-feed.js.map +1 -1
- package/dist/esm/funcs/users-posts-get-by-post-id.d.ts +1 -1
- package/dist/esm/funcs/users-posts-get-by-post-id.d.ts.map +1 -1
- package/dist/esm/funcs/users-posts-get-by-post-id.js +3 -2
- package/dist/esm/funcs/users-posts-get-by-post-id.js.map +1 -1
- package/dist/esm/funcs/users-posts-get-by-user-id.d.ts +1 -1
- package/dist/esm/funcs/users-posts-get-by-user-id.d.ts.map +1 -1
- package/dist/esm/funcs/users-posts-get-by-user-id.js +3 -2
- package/dist/esm/funcs/users-posts-get-by-user-id.js.map +1 -1
- package/dist/esm/funcs/users-posts-update.d.ts +1 -1
- package/dist/esm/funcs/users-posts-update.d.ts.map +1 -1
- package/dist/esm/funcs/users-posts-update.js +3 -2
- package/dist/esm/funcs/users-posts-update.js.map +1 -1
- package/dist/esm/funcs/users-signup.d.ts +1 -1
- package/dist/esm/funcs/users-signup.d.ts.map +1 -1
- package/dist/esm/funcs/users-signup.js +3 -2
- package/dist/esm/funcs/users-signup.js.map +1 -1
- package/dist/esm/funcs/users-update.d.ts +1 -1
- package/dist/esm/funcs/users-update.d.ts.map +1 -1
- package/dist/esm/funcs/users-update.js +3 -2
- package/dist/esm/funcs/users-update.js.map +1 -1
- package/dist/esm/lib/config.d.ts +4 -4
- package/dist/esm/lib/config.js +4 -4
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/lib/matchers.d.ts.map +1 -1
- package/dist/esm/lib/matchers.js +0 -1
- package/dist/esm/lib/matchers.js.map +1 -1
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js +1 -2
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/models/operations/accept-friend-request.d.ts +15 -0
- package/dist/esm/models/operations/accept-friend-request.d.ts.map +1 -0
- package/dist/esm/models/operations/accept-friend-request.js +12 -0
- package/dist/esm/models/operations/accept-friend-request.js.map +1 -0
- package/dist/esm/models/operations/get-feed.d.ts +3 -15
- package/dist/esm/models/operations/get-feed.d.ts.map +1 -1
- package/dist/esm/models/operations/get-feed.js +3 -13
- package/dist/esm/models/operations/get-feed.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +6 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +6 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/list-friends.d.ts +26 -0
- package/dist/esm/models/operations/list-friends.d.ts.map +1 -0
- package/dist/esm/models/operations/list-friends.js +27 -0
- package/dist/esm/models/operations/list-friends.js.map +1 -0
- package/dist/esm/models/operations/pending-friend-requests.d.ts +16 -0
- package/dist/esm/models/operations/pending-friend-requests.d.ts.map +1 -0
- package/dist/esm/models/operations/pending-friend-requests.js +20 -0
- package/dist/esm/models/operations/pending-friend-requests.js.map +1 -0
- package/dist/esm/models/operations/reject-friend-request.d.ts +15 -0
- package/dist/esm/models/operations/reject-friend-request.d.ts.map +1 -0
- package/dist/esm/models/operations/reject-friend-request.js +12 -0
- package/dist/esm/models/operations/reject-friend-request.js.map +1 -0
- package/dist/esm/models/operations/remove-friend.d.ts +12 -0
- package/dist/esm/models/operations/remove-friend.d.ts.map +1 -0
- package/dist/esm/models/operations/remove-friend.js +12 -0
- package/dist/esm/models/operations/remove-friend.js.map +1 -0
- package/dist/esm/models/operations/send-friend-request.d.ts +12 -0
- package/dist/esm/models/operations/send-friend-request.d.ts.map +1 -0
- package/dist/esm/models/operations/send-friend-request.js +12 -0
- package/dist/esm/models/operations/send-friend-request.js.map +1 -0
- package/dist/esm/sdk/activities.d.ts +5 -5
- package/dist/esm/sdk/activities.d.ts.map +1 -1
- package/dist/esm/sdk/categories.d.ts +3 -3
- package/dist/esm/sdk/categories.d.ts.map +1 -1
- package/dist/esm/sdk/friends.d.ts +29 -0
- package/dist/esm/sdk/friends.d.ts.map +1 -0
- package/dist/esm/sdk/friends.js +50 -0
- package/dist/esm/sdk/friends.js.map +1 -0
- package/dist/esm/sdk/posts.d.ts +4 -4
- package/dist/esm/sdk/posts.d.ts.map +1 -1
- package/dist/esm/sdk/schools.d.ts +1 -1
- package/dist/esm/sdk/schools.d.ts.map +1 -1
- package/dist/esm/sdk/users.d.ts +8 -5
- package/dist/esm/sdk/users.d.ts.map +1 -1
- package/dist/esm/sdk/users.js +4 -0
- package/dist/esm/sdk/users.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/rest-api/cypress/e2e/{activity-post-endpoints.cy.ts → activity-post-endpoints.cy.js} +2 -3
- package/rest-api/cypress/e2e/friend-endpoints.cy.js +262 -0
- package/rest-api/cypress/e2e/{school-endpoints.cy.ts → school-endpoints.cy.js} +1 -1
- package/rest-api/cypress.config.ts +47 -3
- package/rest-api/index.js +8 -1
- package/rest-api/lib/users.js +7 -5
- package/rest-api/routes/ActivityPostFunctions.js +73 -2
- package/rest-api/routes/FriendFunctions.js +266 -0
- package/rest-api/routes/UserActivityFunctions.js +1 -1
- package/src/funcs/categories-create.ts +14 -6
- package/src/funcs/categories-delete.ts +3 -2
- package/src/funcs/categories-get-all.ts +14 -6
- package/src/funcs/categories-update.ts +14 -6
- package/src/funcs/schools-get-all.ts +2 -2
- package/src/funcs/schools-get.ts +11 -6
- package/src/funcs/users-activities-create.ts +14 -6
- package/src/funcs/users-activities-delete.ts +3 -2
- package/src/funcs/users-activities-get-all-of-user.ts +18 -6
- package/src/funcs/users-activities-get.ts +14 -6
- package/src/funcs/users-activities-me.ts +14 -6
- package/src/funcs/users-activities-update.ts +14 -6
- package/src/funcs/users-delete.ts +3 -2
- package/src/funcs/users-friends-accept.ts +176 -0
- package/src/funcs/users-friends-list.ts +182 -0
- package/src/funcs/users-friends-pending.ts +162 -0
- package/src/funcs/users-friends-reject.ts +176 -0
- package/src/funcs/users-friends-remove.ts +175 -0
- package/src/funcs/users-friends-send-request.ts +176 -0
- package/src/funcs/users-get.ts +11 -6
- package/src/funcs/users-login.ts +11 -6
- package/src/funcs/users-me.ts +14 -6
- package/src/funcs/users-posts-delete.ts +3 -2
- package/src/funcs/users-posts-feed.ts +15 -7
- package/src/funcs/users-posts-get-by-post-id.ts +11 -6
- package/src/funcs/users-posts-get-by-user-id.ts +14 -6
- package/src/funcs/users-posts-update.ts +11 -6
- package/src/funcs/users-signup.ts +8 -6
- package/src/funcs/users-update.ts +11 -6
- package/src/lib/config.ts +4 -4
- package/src/lib/matchers.ts +3 -2
- package/src/lib/security.ts +1 -2
- package/src/models/operations/accept-friend-request.ts +33 -0
- package/src/models/operations/get-feed.ts +9 -37
- package/src/models/operations/index.ts +6 -0
- package/src/models/operations/list-friends.ts +68 -0
- package/src/models/operations/pending-friend-requests.ts +43 -0
- package/src/models/operations/reject-friend-request.ts +33 -0
- package/src/models/operations/remove-friend.ts +30 -0
- package/src/models/operations/send-friend-request.ts +30 -0
- package/src/sdk/activities.ts +5 -5
- package/src/sdk/categories.ts +3 -3
- package/src/sdk/friends.ts +97 -0
- package/src/sdk/posts.ts +4 -4
- package/src/sdk/schools.ts +1 -1
- package/src/sdk/users.ts +11 -5
- /package/rest-api/cypress/e2e/{category-endpoints.cy.ts → category-endpoints.cy.js} +0 -0
- /package/rest-api/cypress/e2e/{user-activity-endpoints.cy.ts → user-activity-endpoints.cy.js} +0 -0
- /package/rest-api/cypress/e2e/{user-endpoints.cy.ts → user-endpoints.cy.js} +0 -0
|
@@ -8,8 +8,15 @@ export default defineConfig({
|
|
|
8
8
|
// drop test artifacts
|
|
9
9
|
async reseedUsersTable() {
|
|
10
10
|
return await prisma.$transaction([
|
|
11
|
-
prisma
|
|
12
|
-
|
|
11
|
+
prisma.users.deleteMany({
|
|
12
|
+
where: {
|
|
13
|
+
user_id: {
|
|
14
|
+
notIn: [2, 3]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}),
|
|
18
|
+
prisma.$executeRaw`UPDATE users SET is_soft_deleted = 0, first_name = 'Unit', last_name = 'Test', username = 'UnitTester' WHERE user_id = 2;`,
|
|
19
|
+
prisma.$executeRaw`UPDATE users SET is_soft_deleted = 0, first_name = 'Unit', last_name = 'Test Jr.', username = 'UnitTester2' WHERE user_id = 3;`,
|
|
13
20
|
]);
|
|
14
21
|
},
|
|
15
22
|
|
|
@@ -43,8 +50,45 @@ export default defineConfig({
|
|
|
43
50
|
|
|
44
51
|
async reseedUserActivityPostsTable() {
|
|
45
52
|
return await prisma.$transaction([
|
|
46
|
-
prisma.$executeRaw`REPLACE INTO User_Activity_Posts (post_id, user_id, category_name, activity_id, post_date, post_status, caption) VALUES (1, 2, 'Professional', 1, '2026-02-28 22:15:02', 'public', 'This is a test post! Nothing much going on here...')
|
|
53
|
+
prisma.$executeRaw`REPLACE INTO User_Activity_Posts (post_id, user_id, category_name, activity_id, post_date, post_status, caption) VALUES (1, 2, 'Professional', 1, '2026-02-28 22:15:02', 'public', 'This is a test post! Nothing much going on here...');`,
|
|
54
|
+
prisma.$executeRaw`REPLACE INTO User_Activity_Posts (post_id, user_id, category_name, activity_id, post_date, post_status, caption) VALUES (2, 3, 'Professional', 1, '2026-02-28 22:15:02', 'public', 'This is a test post! Nothing much going on here...');`
|
|
47
55
|
])
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// tasks used for friend request unit tests to work correctly
|
|
59
|
+
async clearFriendRequestsTable() {
|
|
60
|
+
return await prisma.$transaction([
|
|
61
|
+
prisma.friend_Requests.deleteMany({})
|
|
62
|
+
])
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
async prepAcceptedFriendRequests() {
|
|
66
|
+
const [res] = await prisma.$transaction([
|
|
67
|
+
prisma.friend_Requests.create({
|
|
68
|
+
data: {
|
|
69
|
+
friend_request_id: 1,
|
|
70
|
+
initiator_user_id: 2,
|
|
71
|
+
target_user_id: 3,
|
|
72
|
+
status: "accepted"
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
]);
|
|
76
|
+
return !!res;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
async prepPendingFriendRequests() {
|
|
80
|
+
const [res] = await prisma.$transaction([
|
|
81
|
+
prisma.friend_Requests.create({
|
|
82
|
+
data: {
|
|
83
|
+
friend_request_id: 1,
|
|
84
|
+
initiator_user_id: 2,
|
|
85
|
+
target_user_id: 3,
|
|
86
|
+
status: "pending"
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
return !!res;
|
|
48
92
|
}
|
|
49
93
|
})
|
|
50
94
|
},
|
package/rest-api/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import * as SchoolFunctions from "./routes/SchoolFunctions.js";
|
|
|
9
9
|
import * as CategoryFunctions from "./routes/CategoryFunctions.js";
|
|
10
10
|
import * as UserActivityFunctions from "./routes/UserActivityFunctions.js";
|
|
11
11
|
import * as ActivityPostFunctions from "./routes/ActivityPostFunctions.js";
|
|
12
|
+
import * as FriendFunctions from "./routes/FriendFunctions.js";
|
|
12
13
|
|
|
13
14
|
const spec = yamlLoad(readFileSync("./api-spec.yaml"));
|
|
14
15
|
|
|
@@ -42,7 +43,13 @@ const handler = {
|
|
|
42
43
|
getFeed: ActivityPostFunctions.getFeedHandler,
|
|
43
44
|
getPostById: ActivityPostFunctions.getPostByIdHandler,
|
|
44
45
|
updatePost: ActivityPostFunctions.updatePostHandler,
|
|
45
|
-
deletePost: ActivityPostFunctions.deletePostHandler
|
|
46
|
+
deletePost: ActivityPostFunctions.deletePostHandler,
|
|
47
|
+
listFriends: FriendFunctions.listFriendsHandler,
|
|
48
|
+
sendFriendRequest: FriendFunctions.sendFriendRequestHandler,
|
|
49
|
+
acceptFriendRequest: FriendFunctions.acceptFriendRequestHandler,
|
|
50
|
+
rejectFriendRequest: FriendFunctions.rejectFriendRequestHandler,
|
|
51
|
+
pendingFriendRequests: FriendFunctions.pendingFriendRequestsHandler,
|
|
52
|
+
removeFriend: FriendFunctions.removeFriendHandler
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
fastify.register(oasFastify, { spec, handler });
|
package/rest-api/lib/users.js
CHANGED
|
@@ -10,16 +10,18 @@ export async function getUserAuthInfo(prisma, accessToken) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export async function areUsersFriends(prisma, userId, targetPotentialFriendId) {
|
|
13
|
-
const friendInfo = await prisma.
|
|
13
|
+
const friendInfo = await prisma.Friend_Requests.findFirst({
|
|
14
14
|
where: {
|
|
15
15
|
OR: [
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
initiator_user_id: userId,
|
|
18
|
+
target_user_id: targetPotentialFriendId,
|
|
19
|
+
status: "accepted"
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
initiator_user_id: targetPotentialFriendId,
|
|
23
|
+
target_user_id: userId,
|
|
24
|
+
status: "accepted"
|
|
23
25
|
},
|
|
24
26
|
],
|
|
25
27
|
},
|
|
@@ -63,8 +63,79 @@ export async function getFeedHandler(request, reply, fastify) {
|
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const limit = Math.min(request.query.limit ?? 100, 100);
|
|
67
|
+
const lastPostId = request.query.lastPostId ?? -1;
|
|
68
|
+
|
|
69
|
+
const friendIdsInfo = await fastify.prisma.Friend_Requests.findMany({
|
|
70
|
+
where: {
|
|
71
|
+
OR: [
|
|
72
|
+
{
|
|
73
|
+
initiator_user_id: userInfo.user_id,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
target_user_id: userInfo.user_id
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
select: {
|
|
82
|
+
users_Friend_Requests_target_user_idTousers: {
|
|
83
|
+
select: {
|
|
84
|
+
user_id: true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
users_Friend_Requests_initiator_user_idTousers: {
|
|
88
|
+
select: {
|
|
89
|
+
user_id: true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const friendIds = friendIdsInfo.map(friendIdInfo => friendIdInfo.users_Friend_Requests_target_user_idTousers.user_id === userInfo.user_id ? friendIdInfo.users_Friend_Requests_initiator_user_idTousers.user_id : friendIdInfo.users_Friend_Requests_target_user_idTousers.user_id);
|
|
96
|
+
|
|
97
|
+
const posts = await fastify.prisma.User_Activity_Posts.findMany({
|
|
98
|
+
where: {
|
|
99
|
+
user_id: {
|
|
100
|
+
in: friendIds
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
select: {
|
|
104
|
+
post_id: true,
|
|
105
|
+
post_date: true,
|
|
106
|
+
post_status: true,
|
|
107
|
+
users: {
|
|
108
|
+
select: {
|
|
109
|
+
user_id: true
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
Category: {
|
|
113
|
+
select: {
|
|
114
|
+
category_name: true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
User_Activity: {
|
|
118
|
+
select: {
|
|
119
|
+
activity_id: true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
orderBy: {
|
|
124
|
+
post_date: "desc"
|
|
125
|
+
},
|
|
126
|
+
take: limit,
|
|
127
|
+
cursor: lastPostId !== -1 ? { post_id: lastPostId } : undefined,
|
|
128
|
+
skip: lastPostId !== -1 ? 1 : undefined
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
return posts.map(post => ({
|
|
132
|
+
postId: post.post_id,
|
|
133
|
+
postDate: post.post_date,
|
|
134
|
+
postStatus: post.post_status,
|
|
135
|
+
userId: post.users.user_id,
|
|
136
|
+
categoryName: post.Category.category_name,
|
|
137
|
+
activityId: post.User_Activity.activity_id
|
|
138
|
+
}));
|
|
68
139
|
}
|
|
69
140
|
|
|
70
141
|
export async function getPostByIdHandler(request, reply, fastify) {
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { getUserAuthInfo, areUsersFriends } from "../lib/users.js";
|
|
2
|
+
|
|
3
|
+
export async function listFriendsHandler(request, reply, fastify) {
|
|
4
|
+
const accessToken = (request.headers.authorization ?? "").substring(7);
|
|
5
|
+
const userInfo = await getUserAuthInfo(fastify.prisma, accessToken);
|
|
6
|
+
|
|
7
|
+
if (userInfo === null) {
|
|
8
|
+
reply.status(401);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const targetUserCheck = await fastify.prisma.users.findFirst({
|
|
13
|
+
where: {
|
|
14
|
+
user_id: request.params.id
|
|
15
|
+
},
|
|
16
|
+
select: {
|
|
17
|
+
user_id: true
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
if (targetUserCheck === null) {
|
|
21
|
+
reply.status(404);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const friendsList = await fastify.prisma.Friend_Requests.findMany({
|
|
26
|
+
where: {
|
|
27
|
+
OR: [
|
|
28
|
+
{ initiator_user_id: request.params.id, status: "accepted" },
|
|
29
|
+
{ target_user_id: request.params.id, status: "accepted" }
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
select: {
|
|
33
|
+
users_Friend_Requests_initiator_user_idTousers: {
|
|
34
|
+
select: {
|
|
35
|
+
user_id: true,
|
|
36
|
+
first_name: true,
|
|
37
|
+
last_name: true,
|
|
38
|
+
username: true,
|
|
39
|
+
email: true,
|
|
40
|
+
school: {
|
|
41
|
+
select: { school_id: true, school_name: true }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
users_Friend_Requests_target_user_idTousers: {
|
|
46
|
+
select: {
|
|
47
|
+
user_id: true,
|
|
48
|
+
first_name: true,
|
|
49
|
+
last_name: true,
|
|
50
|
+
username: true,
|
|
51
|
+
email: true,
|
|
52
|
+
school: {
|
|
53
|
+
select: { school_id: true, school_name: true }
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return friendsList.map(friendEntry => {
|
|
61
|
+
// determine which side of the relationship is the friend (not the current user)
|
|
62
|
+
const friend = Number(friendEntry.users_Friend_Requests_initiator_user_idTousers.user_id) === request.params.id
|
|
63
|
+
? friendEntry.users_Friend_Requests_target_user_idTousers
|
|
64
|
+
: friendEntry.users_Friend_Requests_initiator_user_idTousers;
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
userId: Number(friend.user_id),
|
|
68
|
+
firstName: friend.first_name,
|
|
69
|
+
lastName: friend.last_name,
|
|
70
|
+
username: friend.username,
|
|
71
|
+
email: friend.email,
|
|
72
|
+
schoolId: Number(friend.school.school_id),
|
|
73
|
+
schoolName: friend.school.school_name,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function pendingFriendRequestsHandler(request, reply, fastify) {
|
|
79
|
+
const accessToken = (request.headers.authorization ?? "").substring(7);
|
|
80
|
+
const userInfo = await getUserAuthInfo(fastify.prisma, accessToken);
|
|
81
|
+
|
|
82
|
+
if (userInfo === null) {
|
|
83
|
+
reply.status(401);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const pendingFriendRequests = await fastify.prisma.Friend_Requests.findMany({
|
|
88
|
+
where: {
|
|
89
|
+
target_user_id: userInfo.user_id,
|
|
90
|
+
status: "pending"
|
|
91
|
+
},
|
|
92
|
+
select: {
|
|
93
|
+
users_Friend_Requests_initiator_user_idTousers: {
|
|
94
|
+
select: {
|
|
95
|
+
user_id: true,
|
|
96
|
+
first_name: true,
|
|
97
|
+
last_name: true,
|
|
98
|
+
username: true,
|
|
99
|
+
email: true,
|
|
100
|
+
school: {
|
|
101
|
+
select: { school_id: true, school_name: true }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return pendingFriendRequests.map(friendRequest => ({
|
|
109
|
+
userId: Number(friendRequest.users_Friend_Requests_initiator_user_idTousers.user_id),
|
|
110
|
+
firstName: friendRequest.users_Friend_Requests_initiator_user_idTousers.first_name,
|
|
111
|
+
lastName: friendRequest.users_Friend_Requests_initiator_user_idTousers.last_name,
|
|
112
|
+
username: friendRequest.users_Friend_Requests_initiator_user_idTousers.username,
|
|
113
|
+
email: friendRequest.users_Friend_Requests_initiator_user_idTousers.email,
|
|
114
|
+
schoolId: Number(friendRequest.users_Friend_Requests_initiator_user_idTousers.school.school_id),
|
|
115
|
+
schoolName: friendRequest.users_Friend_Requests_initiator_user_idTousers.school.school_name,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function sendFriendRequestHandler(request, reply, fastify) {
|
|
120
|
+
const accessToken = (request.headers.authorization ?? "").substring(7);
|
|
121
|
+
const userInfo = await getUserAuthInfo(fastify.prisma, accessToken);
|
|
122
|
+
|
|
123
|
+
if (userInfo === null) {
|
|
124
|
+
reply.status(401);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const targetUserInfo = await fastify.prisma.users.findFirst({
|
|
129
|
+
where: {
|
|
130
|
+
user_id: request.params.id
|
|
131
|
+
},
|
|
132
|
+
select: {
|
|
133
|
+
user_id: true
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
if (targetUserInfo === null) {
|
|
137
|
+
reply.status(404);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const areFriends = await areUsersFriends(fastify.prisma, userInfo.user_id, request.params.id);
|
|
142
|
+
if (areFriends) {
|
|
143
|
+
reply.status(400);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
await fastify.prisma.Friend_Requests.create({
|
|
148
|
+
data: {
|
|
149
|
+
initiator_user_id: userInfo.user_id,
|
|
150
|
+
target_user_id: request.params.id
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
reply.status(201);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// TODO move the core functionality code to a separate
|
|
158
|
+
// library function since accept and reject friend request
|
|
159
|
+
// are both very similar
|
|
160
|
+
export async function acceptFriendRequestHandler(request, reply, fastify) {
|
|
161
|
+
const accessToken = (request.headers.authorization ?? "").substring(7);
|
|
162
|
+
const userInfo = await getUserAuthInfo(fastify.prisma, accessToken);
|
|
163
|
+
|
|
164
|
+
if (userInfo === null) {
|
|
165
|
+
reply.status(401);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const friendRequest = await fastify.prisma.Friend_Requests.findFirst({
|
|
170
|
+
where: {
|
|
171
|
+
target_user_id: userInfo.user_id,
|
|
172
|
+
initiator_user_id: request.params.id,
|
|
173
|
+
status: "pending"
|
|
174
|
+
},
|
|
175
|
+
select: {
|
|
176
|
+
friend_request_id: true
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
if (friendRequest === null) {
|
|
181
|
+
reply.status(404);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
await fastify.prisma.Friend_Requests.update({
|
|
186
|
+
where: {
|
|
187
|
+
friend_request_id: friendRequest.friend_request_id
|
|
188
|
+
},
|
|
189
|
+
data: {
|
|
190
|
+
status: "accepted"
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export async function rejectFriendRequestHandler(request, reply, fastify) {
|
|
196
|
+
const accessToken = (request.headers.authorization ?? "").substring(7);
|
|
197
|
+
const userInfo = await getUserAuthInfo(fastify.prisma, accessToken);
|
|
198
|
+
|
|
199
|
+
if (userInfo === null) {
|
|
200
|
+
reply.status(401);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const friendRequest = await fastify.prisma.Friend_Requests.findFirst({
|
|
205
|
+
where: {
|
|
206
|
+
target_user_id: userInfo.user_id,
|
|
207
|
+
initiator_user_id: request.params.id,
|
|
208
|
+
status: "pending"
|
|
209
|
+
},
|
|
210
|
+
select: {
|
|
211
|
+
friend_request_id: true
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
if (friendRequest === null) {
|
|
216
|
+
reply.status(404);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
await fastify.prisma.Friend_Requests.delete({
|
|
221
|
+
where: {
|
|
222
|
+
friend_request_id: friendRequest.friend_request_id
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export async function removeFriendHandler(request, reply, fastify) {
|
|
228
|
+
const accessToken = (request.headers.authorization ?? "").substring(7);
|
|
229
|
+
const userInfo = await getUserAuthInfo(fastify.prisma, accessToken);
|
|
230
|
+
|
|
231
|
+
if (userInfo === null) {
|
|
232
|
+
reply.status(401);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const friendship = await fastify.prisma.Friend_Requests.findFirst({
|
|
237
|
+
where: {
|
|
238
|
+
OR: [
|
|
239
|
+
{
|
|
240
|
+
initiator_user_id: userInfo.user_id,
|
|
241
|
+
target_user_id: request.params.friendId,
|
|
242
|
+
status: "accepted"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
initiator_user_id: request.params.friendId,
|
|
246
|
+
target_user_id: userInfo.user_id,
|
|
247
|
+
status: "accepted"
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
select: {
|
|
252
|
+
friend_request_id: true
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
if (friendship === null) {
|
|
257
|
+
reply.status(404);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
await fastify.prisma.Friend_Requests.delete({
|
|
262
|
+
where: {
|
|
263
|
+
friend_request_id: friendship.friend_request_id
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getUserAuthInfo, areUsersFriends } from "../lib/users.js";
|
|
2
2
|
|
|
3
3
|
export async function getUserActivitiesHandler(request, reply, fastify) {
|
|
4
|
-
const accessToken = (request.headers.authorization ?? "").substring(7)
|
|
4
|
+
const accessToken = (request.headers.authorization ?? "").substring(7);
|
|
5
5
|
const targetUserId = request.params.id;
|
|
6
6
|
const userInfo = await getUserAuthInfo(fastify.prisma, accessToken);
|
|
7
7
|
|
|
@@ -24,6 +24,7 @@ import { SenseiProductivityError } from "../models/errors/sensei-productivity-er
|
|
|
24
24
|
import * as operations from "../models/operations/index.js";
|
|
25
25
|
import { APICall, APIPromise } from "../types/async.js";
|
|
26
26
|
import { Result } from "../types/fp.js";
|
|
27
|
+
import * as types$ from "../types/primitives.js";
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Create a new category (school admins only)
|
|
@@ -34,7 +35,7 @@ export function categoriesCreate(
|
|
|
34
35
|
options?: RequestOptions,
|
|
35
36
|
): APIPromise<
|
|
36
37
|
Result<
|
|
37
|
-
operations.CreateCategoryResponse,
|
|
38
|
+
operations.CreateCategoryResponse | undefined,
|
|
38
39
|
| SenseiProductivityError
|
|
39
40
|
| ResponseValidationError
|
|
40
41
|
| ConnectionError
|
|
@@ -59,7 +60,7 @@ async function $do(
|
|
|
59
60
|
): Promise<
|
|
60
61
|
[
|
|
61
62
|
Result<
|
|
62
|
-
operations.CreateCategoryResponse,
|
|
63
|
+
operations.CreateCategoryResponse | undefined,
|
|
63
64
|
| SenseiProductivityError
|
|
64
65
|
| ResponseValidationError
|
|
65
66
|
| ConnectionError
|
|
@@ -136,7 +137,7 @@ async function $do(
|
|
|
136
137
|
|
|
137
138
|
const doResult = await client._do(req, {
|
|
138
139
|
context,
|
|
139
|
-
errorCodes: ["
|
|
140
|
+
errorCodes: ["429", "5XX"],
|
|
140
141
|
retryConfig: context.retryConfig,
|
|
141
142
|
retryCodes: context.retryCodes,
|
|
142
143
|
});
|
|
@@ -146,7 +147,7 @@ async function $do(
|
|
|
146
147
|
const response = doResult.value;
|
|
147
148
|
|
|
148
149
|
const [result] = await M.match<
|
|
149
|
-
operations.CreateCategoryResponse,
|
|
150
|
+
operations.CreateCategoryResponse | undefined,
|
|
150
151
|
| SenseiProductivityError
|
|
151
152
|
| ResponseValidationError
|
|
152
153
|
| ConnectionError
|
|
@@ -156,8 +157,15 @@ async function $do(
|
|
|
156
157
|
| UnexpectedClientError
|
|
157
158
|
| SDKValidationError
|
|
158
159
|
>(
|
|
159
|
-
M.json(
|
|
160
|
-
|
|
160
|
+
M.json(
|
|
161
|
+
201,
|
|
162
|
+
types$.optional(operations.CreateCategoryResponse$inboundSchema),
|
|
163
|
+
),
|
|
164
|
+
M.nil(
|
|
165
|
+
[400, 401, 403],
|
|
166
|
+
types$.optional(operations.CreateCategoryResponse$inboundSchema),
|
|
167
|
+
),
|
|
168
|
+
M.fail(429),
|
|
161
169
|
M.fail("5XX"),
|
|
162
170
|
)(response, req);
|
|
163
171
|
if (!result.ok) {
|
|
@@ -142,7 +142,7 @@ async function $do(
|
|
|
142
142
|
|
|
143
143
|
const doResult = await client._do(req, {
|
|
144
144
|
context,
|
|
145
|
-
errorCodes: ["
|
|
145
|
+
errorCodes: ["429", "5XX"],
|
|
146
146
|
retryConfig: context.retryConfig,
|
|
147
147
|
retryCodes: context.retryCodes,
|
|
148
148
|
});
|
|
@@ -163,7 +163,8 @@ async function $do(
|
|
|
163
163
|
| SDKValidationError
|
|
164
164
|
>(
|
|
165
165
|
M.nil(200, z.void()),
|
|
166
|
-
M.
|
|
166
|
+
M.nil([401, 403, 404], z.void()),
|
|
167
|
+
M.fail(429),
|
|
167
168
|
M.fail("5XX"),
|
|
168
169
|
)(response, req);
|
|
169
170
|
if (!result.ok) {
|
|
@@ -22,6 +22,7 @@ import { SenseiProductivityError } from "../models/errors/sensei-productivity-er
|
|
|
22
22
|
import * as operations from "../models/operations/index.js";
|
|
23
23
|
import { APICall, APIPromise } from "../types/async.js";
|
|
24
24
|
import { Result } from "../types/fp.js";
|
|
25
|
+
import * as types$ from "../types/primitives.js";
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* List all categories
|
|
@@ -31,7 +32,7 @@ export function categoriesGetAll(
|
|
|
31
32
|
options?: RequestOptions,
|
|
32
33
|
): APIPromise<
|
|
33
34
|
Result<
|
|
34
|
-
Array<operations.ListCategoriesResponse
|
|
35
|
+
Array<operations.ListCategoriesResponse> | undefined,
|
|
35
36
|
| SenseiProductivityError
|
|
36
37
|
| ResponseValidationError
|
|
37
38
|
| ConnectionError
|
|
@@ -54,7 +55,7 @@ async function $do(
|
|
|
54
55
|
): Promise<
|
|
55
56
|
[
|
|
56
57
|
Result<
|
|
57
|
-
Array<operations.ListCategoriesResponse
|
|
58
|
+
Array<operations.ListCategoriesResponse> | undefined,
|
|
58
59
|
| SenseiProductivityError
|
|
59
60
|
| ResponseValidationError
|
|
60
61
|
| ConnectionError
|
|
@@ -118,7 +119,7 @@ async function $do(
|
|
|
118
119
|
|
|
119
120
|
const doResult = await client._do(req, {
|
|
120
121
|
context,
|
|
121
|
-
errorCodes: ["
|
|
122
|
+
errorCodes: ["429", "5XX"],
|
|
122
123
|
retryConfig: context.retryConfig,
|
|
123
124
|
retryCodes: context.retryCodes,
|
|
124
125
|
});
|
|
@@ -128,7 +129,7 @@ async function $do(
|
|
|
128
129
|
const response = doResult.value;
|
|
129
130
|
|
|
130
131
|
const [result] = await M.match<
|
|
131
|
-
Array<operations.ListCategoriesResponse
|
|
132
|
+
Array<operations.ListCategoriesResponse> | undefined,
|
|
132
133
|
| SenseiProductivityError
|
|
133
134
|
| ResponseValidationError
|
|
134
135
|
| ConnectionError
|
|
@@ -138,8 +139,15 @@ async function $do(
|
|
|
138
139
|
| UnexpectedClientError
|
|
139
140
|
| SDKValidationError
|
|
140
141
|
>(
|
|
141
|
-
M.json(
|
|
142
|
-
|
|
142
|
+
M.json(
|
|
143
|
+
200,
|
|
144
|
+
types$.optional(z.array(operations.ListCategoriesResponse$inboundSchema)),
|
|
145
|
+
),
|
|
146
|
+
M.nil(
|
|
147
|
+
401,
|
|
148
|
+
types$.optional(z.array(operations.ListCategoriesResponse$inboundSchema)),
|
|
149
|
+
),
|
|
150
|
+
M.fail(429),
|
|
143
151
|
M.fail("5XX"),
|
|
144
152
|
)(response, req);
|
|
145
153
|
if (!result.ok) {
|
|
@@ -24,6 +24,7 @@ import { SenseiProductivityError } from "../models/errors/sensei-productivity-er
|
|
|
24
24
|
import * as operations from "../models/operations/index.js";
|
|
25
25
|
import { APICall, APIPromise } from "../types/async.js";
|
|
26
26
|
import { Result } from "../types/fp.js";
|
|
27
|
+
import * as types$ from "../types/primitives.js";
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Update a category (school admins only)
|
|
@@ -34,7 +35,7 @@ export function categoriesUpdate(
|
|
|
34
35
|
options?: RequestOptions,
|
|
35
36
|
): APIPromise<
|
|
36
37
|
Result<
|
|
37
|
-
operations.UpdateCategoryResponse,
|
|
38
|
+
operations.UpdateCategoryResponse | undefined,
|
|
38
39
|
| SenseiProductivityError
|
|
39
40
|
| ResponseValidationError
|
|
40
41
|
| ConnectionError
|
|
@@ -59,7 +60,7 @@ async function $do(
|
|
|
59
60
|
): Promise<
|
|
60
61
|
[
|
|
61
62
|
Result<
|
|
62
|
-
operations.UpdateCategoryResponse,
|
|
63
|
+
operations.UpdateCategoryResponse | undefined,
|
|
63
64
|
| SenseiProductivityError
|
|
64
65
|
| ResponseValidationError
|
|
65
66
|
| ConnectionError
|
|
@@ -143,7 +144,7 @@ async function $do(
|
|
|
143
144
|
|
|
144
145
|
const doResult = await client._do(req, {
|
|
145
146
|
context,
|
|
146
|
-
errorCodes: ["
|
|
147
|
+
errorCodes: ["429", "5XX"],
|
|
147
148
|
retryConfig: context.retryConfig,
|
|
148
149
|
retryCodes: context.retryCodes,
|
|
149
150
|
});
|
|
@@ -153,7 +154,7 @@ async function $do(
|
|
|
153
154
|
const response = doResult.value;
|
|
154
155
|
|
|
155
156
|
const [result] = await M.match<
|
|
156
|
-
operations.UpdateCategoryResponse,
|
|
157
|
+
operations.UpdateCategoryResponse | undefined,
|
|
157
158
|
| SenseiProductivityError
|
|
158
159
|
| ResponseValidationError
|
|
159
160
|
| ConnectionError
|
|
@@ -163,8 +164,15 @@ async function $do(
|
|
|
163
164
|
| UnexpectedClientError
|
|
164
165
|
| SDKValidationError
|
|
165
166
|
>(
|
|
166
|
-
M.json(
|
|
167
|
-
|
|
167
|
+
M.json(
|
|
168
|
+
200,
|
|
169
|
+
types$.optional(operations.UpdateCategoryResponse$inboundSchema),
|
|
170
|
+
),
|
|
171
|
+
M.nil(
|
|
172
|
+
[400, 401, 403, 404],
|
|
173
|
+
types$.optional(operations.UpdateCategoryResponse$inboundSchema),
|
|
174
|
+
),
|
|
175
|
+
M.fail(429),
|
|
168
176
|
M.fail("5XX"),
|
|
169
177
|
)(response, req);
|
|
170
178
|
if (!result.ok) {
|
|
@@ -118,7 +118,7 @@ async function $do(
|
|
|
118
118
|
|
|
119
119
|
const doResult = await client._do(req, {
|
|
120
120
|
context,
|
|
121
|
-
errorCodes: ["
|
|
121
|
+
errorCodes: ["429", "5XX"],
|
|
122
122
|
retryConfig: context.retryConfig,
|
|
123
123
|
retryCodes: context.retryCodes,
|
|
124
124
|
});
|
|
@@ -139,7 +139,7 @@ async function $do(
|
|
|
139
139
|
| SDKValidationError
|
|
140
140
|
>(
|
|
141
141
|
M.json(200, z.array(operations.ListSchoolsResponse$inboundSchema)),
|
|
142
|
-
M.fail(
|
|
142
|
+
M.fail(429),
|
|
143
143
|
M.fail("5XX"),
|
|
144
144
|
)(response, req);
|
|
145
145
|
if (!result.ok) {
|