idz: Implement team leadership transfer
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user