Open L-Mario564 opened 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.
@L-Mario564 it would make more sense to accept one inviteId
at a time instead of multiple for Accept join staff invite
procedure
@L-Mario564 why do we need Nvm, it makes sense if user applies for preferable roles and host decides to assign him roles as he sees fitstaffRoleIds
in input for Accept staff registration response
? It'd be more logical for them to be already defined in form response at this point.
@L-Mario564 it would make more sense to accept one
inviteId
at a time instead of multiple forAccept 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.
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
host
,manage_tournament
.admin
istrue
then only return admin users.Return
Send join staff invite
Insert a record into the Invite table and insert records into InviteWithRole table accordingly.
Input:
toUserId
,tournamentId
,staffRoleIds
. Notesreason
=join_staff
.byUserId
= ID of the session user.Conditions
host
,manage_tournament
.staffRoleIds
must have at least one element.staffRoleIds
must be a role within that tournament.manage_tournament
permissions.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
. Notesreason
=join_staff
.byUserId
= ID of the session user.Conditions
host
.Accept join staff invite
Insert a record into the StaffMember and StaffMemberRole tables and set
Invite.status
toaccepted
.Input:
inviteIds
. NotesInvite.tournamentId
.InviteWithRole.staffRoleId
.StaffMember.userId
should be the same asInvite.toUserId
.Conditions
Invite.status
should bepending
.Invite.toUserId
should be the same as the session user's ID.deletedAt
is defined and past the current date) then instead of inserting, update that record by settingdeletedAt
tonull
andjoinedStaffAt
tonow()
.Accept staff registration response
Insert a record into the StaffMember and StaffMemberRole.
Input:
formResponseId
,staffRoleIds
. NotesStaffMember.userId
=FormResponse.submittedByUserId
Conditions
host
,manage_tournament
.staffRoleIds
must have at least one element.staffRoleIds
must be a role within that tournament.manage_tournament
permissions.deletedAt
is defined and past the current date) then instead of inserting, update that record by settingdeletedAt
tonull
andjoinedStaffAt
tonow()
.Update staff member roles
Insert and delete records of the StaffMemberRole tables accordingly.
Input:
staffMemberId
,staffRoleIds
.Conditions
host
,manage_tournament
.manage_tournament
permission can't remove another staff member's roles that has that permission.manage_tournament
permission can only be assigned and removed by the host.staffRoleIds
must have at least one element.staffRoleIds
must be a role within that tournament.Pseudo-code example
Delete staff member
Set
StaffMember.deletedAt
tonow()
and unlink any roles assigned to this staff member.Input:
staffMemberId
.Conditions
host
,manage_tournament
.manage_tournament
permission can't delete other staff members with that same permission.Leave staff team
Set
StaffMember.deletedAt
tonow()
and unlink any roles assigned to this staff member, said staff member being the current session user.Conditions