Kyoso-Team / kyoso-archive

A web application that takes osu! tournaments beyonds spreadsheets.
http://kyoso.sh
GNU Affero General Public License v3.0
2 stars 1 forks source link

Create staff member tRPC procedures #74

Open L-Mario564 opened 4 months ago

L-Mario564 commented 4 months ago

For each procedure:

(All inputs listed are required/must be defined unless stated with ? appended at the end of the variable name).

Search users

Get a list of users via an inputted string.

Input: query, tournamentId, admin?.

Conditions

Return

Send join staff invite

Insert a record into the Invite table and insert records into InviteWithRole table accordingly.

Input: toUserId, tournamentId, staffRoleIds. Notes

Conditions

Send join staff as debugger invite

Insert a record into the Invite table and insert records into InviteWithRole table so the user can be assigned the debugger role.

Input: toUserId, tournamentId. Notes

Conditions

Accept join staff invite

Insert a record into the StaffMember and StaffMemberRole tables and set Invite.status to accepted.

Input: inviteIds. Notes

Conditions

Accept staff registration response

Insert a record into the StaffMember and StaffMemberRole.

Input: formResponseId, staffRoleIds. Notes

Conditions

Update staff member roles

Insert and delete records of the StaffMemberRole tables accordingly.

Input: staffMemberId, staffRoleIds.

Conditions

Pseudo-code example

current roles: [6, 7, 8]
input:         [7, 8, 9, 10]
=
remove:        [6]
add:           [9, 10]

Delete staff member

Set StaffMember.deletedAt to now() and unlink any roles assigned to this staff member.

Input: staffMemberId.

Conditions

Leave staff team

Set StaffMember.deletedAt to now() and unlink any roles assigned to this staff member, said staff member being the current session user.

Conditions

L-Mario564 commented 4 months ago

To anyone who tackles this issue, please let me know if everything makes sense and also let me know if there are any other conditions to consider, as I've written plenty and could have made mistakes or forget certain interactions/scenarios.

ArtemOsuskyi commented 2 months ago

@L-Mario564 it would make more sense to accept one inviteId at a time instead of multiple for Accept join staff invite procedure

ArtemOsuskyi commented 2 months ago

@L-Mario564 why do we need staffRoleIds in input for Accept staff registration response? It'd be more logical for them to be already defined in form response at this point. Nvm, it makes sense if user applies for preferable roles and host decides to assign him roles as he sees fit

L-Mario564 commented 2 months ago

@L-Mario564 it would make more sense to accept one inviteId at a time instead of multiple for Accept join staff invite procedure

That's a typo on my part, sorry. It's just one ID.

Nvm, it makes sense if user applies for preferable roles and host decides to assign him roles as he sees fit

Correct.