idz: Implement team leadership transfer

This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent 3bee10d948
commit 2478bc5ceb
10 changed files with 73 additions and 0 deletions
+4
View File
@@ -35,6 +35,7 @@ import { unlockProfile } from "./unlockProfile";
import { updateProvisionalStoreRank } from "./updateProvisionalStoreRank";
import { updateResult } from "./updateResult";
import { updateStoryClearNum } from "./updateStoryClearNum";
import { updateTeamLeader } from "./updateTeamLeader";
import { updateTeamMember } from "./updateTeamMember";
import { updateTeamPoints } from "./updateTeamPoints";
import { updateUiReport } from "./updateUiReport";
@@ -159,6 +160,9 @@ export async function dispatch(
case "update_story_clear_num_req":
return updateStoryClearNum(w, req);
case "update_team_leader_req":
return updateTeamLeader(w, req);
case "update_team_member_req":
return updateTeamMember(w, req);
+18
View File
@@ -0,0 +1,18 @@
import { UpdateTeamLeaderRequest } from "../request/updateTeamLeader";
import { UpdateTeamLeaderResponse } from "../response/updateTeamLeader";
import { Repositories } from "../repo";
export async function updateTeamLeader(
w: Repositories,
req: UpdateTeamLeaderRequest
): Promise<UpdateTeamLeaderResponse> {
const profileId = await w.profile().find(req.aimeId);
const teamId = await w.teams().find(req.teamExtId);
await w.teamMembers().makeLeader(teamId, profileId);
return {
type: "update_team_leader_res",
status: 0,
};
}