Kyoso-Team / kyoso

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

Create staff member tRPC procedures #74

Open L-Mario564 opened 2 weeks ago

L-Mario564 commented 2 weeks 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 2 weeks 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.