fix: Fix being unable to do player actions
parent
c9547c43f6
commit
c7874d6d11
|
@ -596,7 +596,7 @@ export class DefaultService {
|
|||
*/
|
||||
public editMemberRoles(
|
||||
teamId: number,
|
||||
targetPlayerId: number,
|
||||
targetPlayerId: string,
|
||||
requestBody?: EditMemberRolesJson,
|
||||
): CancelablePromise<void> {
|
||||
return this.httpRequest.request({
|
||||
|
@ -735,7 +735,7 @@ export class DefaultService {
|
|||
*/
|
||||
public createOrUpdatePlayer(
|
||||
teamId: number,
|
||||
playerId: number,
|
||||
playerId: string,
|
||||
requestBody?: AddPlayerJson,
|
||||
): CancelablePromise<any> {
|
||||
return this.httpRequest.request({
|
||||
|
@ -763,7 +763,7 @@ export class DefaultService {
|
|||
*/
|
||||
public removePlayerFromTeam(
|
||||
teamId: number,
|
||||
targetPlayerId: number,
|
||||
targetPlayerId: string,
|
||||
): CancelablePromise<any> {
|
||||
return this.httpRequest.request({
|
||||
method: 'DELETE',
|
||||
|
|
|
@ -35,7 +35,7 @@ export const useTeamsStore = defineStore("teams", () => {
|
|||
async function fetchTeam(id: number) {
|
||||
const response = await clientStore.call(
|
||||
fetchTeam.name,
|
||||
() => client.default.getTeam(id.toString())
|
||||
() => client.default.getTeam(id)
|
||||
);
|
||||
teams[response.team.id] = response.team;
|
||||
return response;
|
||||
|
@ -44,7 +44,7 @@ export const useTeamsStore = defineStore("teams", () => {
|
|||
async function fetchTeamMembers(id: number) {
|
||||
const response = await clientStore.call(
|
||||
fetchTeamMembers.name,
|
||||
() => client.default.getTeamMembers(id.toString())
|
||||
() => client.default.getTeamMembers(id)
|
||||
);
|
||||
teamMembers[id] = response.map((member): ViewTeamMembersResponse => {
|
||||
member.roles = member.roles.sort((a, b) => (a.isMain === b.isMain ? 0 : a.isMain ? -1 : 1));
|
||||
|
@ -68,11 +68,11 @@ export const useTeamsStore = defineStore("teams", () => {
|
|||
}
|
||||
|
||||
async function updateRoles(teamId: number, playerId: string, roles: RoleSchema[]) {
|
||||
return await client.default.editMemberRoles(teamId.toString(), playerId, { roles });
|
||||
return await client.default.editMemberRoles(teamId, playerId, { roles });
|
||||
}
|
||||
|
||||
async function leaveTeam(teamId: number) {
|
||||
return client.default.removePlayerFromTeam(teamId.toString(), authStore.steamId);
|
||||
return client.default.removePlayerFromTeam(teamId, authStore.steamId);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -18,7 +18,7 @@ export const useIntegrationsStore = defineStore("integrations", () => {
|
|||
|
||||
async function getIntegrations(teamId: number) {
|
||||
hasLoaded.value = false;
|
||||
const response = await client.default.getIntegrations(teamId.toString());
|
||||
const response = await client.default.getIntegrations(teamId);
|
||||
setIntegrations(response);
|
||||
return response;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export const useIntegrationsStore = defineStore("integrations", () => {
|
|||
discordIntegration: discordIntegration.value ?? null,
|
||||
logsTfIntegration: logsTfIntegration.value ?? null,
|
||||
};
|
||||
const response = await client.default.updateIntegrations(teamId.toString(), body);
|
||||
const response = await client.default.updateIntegrations(teamId, body);
|
||||
setIntegrations(response);
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export const useInvitesStore = defineStore("invites", () => {
|
|||
async function getInvites(teamId: number) {
|
||||
return clientStore.call(
|
||||
getInvites.name,
|
||||
() => client.default.getInvites(teamId.toString()),
|
||||
() => client.default.getInvites(teamId),
|
||||
(response) => {
|
||||
teamInvites[teamId] = response;
|
||||
return response;
|
||||
|
@ -21,7 +21,7 @@ export const useInvitesStore = defineStore("invites", () => {
|
|||
}
|
||||
|
||||
async function createInvite(teamId: number) {
|
||||
const response = await client.default.createInvite(teamId.toString());
|
||||
const response = await client.default.createInvite(teamId);
|
||||
teamInvites[teamId].push(response);
|
||||
return response;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export const useInvitesStore = defineStore("invites", () => {
|
|||
}
|
||||
|
||||
async function revokeInvite(teamId: number, key: string) {
|
||||
const response = await client.default.revokeInvite(teamId.toString(), key);
|
||||
const response = await client.default.revokeInvite(teamId, key);
|
||||
teamInvites[teamId] = teamInvites[teamId].filter((invite) => invite.key != key);
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ def delete_team(player: Player, team_id: int):
|
|||
db.session.commit()
|
||||
return make_response(200)
|
||||
|
||||
@api_team.delete("/id/<int:team_id>/player/<int:target_player_id>/")
|
||||
@api_team.delete("/id/<int:team_id>/player/<target_player_id>/")
|
||||
@spec.validate(
|
||||
resp=Response(
|
||||
HTTP_200=None,
|
||||
|
@ -145,7 +145,8 @@ def delete_team(player: Player, team_id: int):
|
|||
operation_id="remove_player_from_team"
|
||||
)
|
||||
@requires_authentication
|
||||
def remove_player_from_team(player: Player, team_id: int, target_player_id: int, **kwargs):
|
||||
def remove_player_from_team(player: Player, team_id: int, target_player_id: str, **kwargs):
|
||||
target_player_id: int = int(target_player_id)
|
||||
player_team = db.session.query(
|
||||
PlayerTeam
|
||||
).where(
|
||||
|
@ -202,7 +203,7 @@ class AddPlayerJson(BaseModel):
|
|||
team_role: PlayerTeam.TeamRole = PlayerTeam.TeamRole.Player
|
||||
is_team_leader: bool = False
|
||||
|
||||
@api_team.put("/id/<int:team_id>/player/<int:player_id>/")
|
||||
@api_team.put("/id/<int:team_id>/player/<player_id>/")
|
||||
@spec.validate(
|
||||
resp=Response(
|
||||
HTTP_200=None,
|
||||
|
@ -211,7 +212,8 @@ class AddPlayerJson(BaseModel):
|
|||
),
|
||||
operation_id="create_or_update_player"
|
||||
)
|
||||
def add_player(player: Player, team_id: int, player_id: int, json: AddPlayerJson):
|
||||
def add_player(player: Player, team_id: int, player_id: str, json: AddPlayerJson):
|
||||
player_id: int = int(player_id)
|
||||
player_team = db.session.query(
|
||||
PlayerTeam
|
||||
).where(
|
||||
|
@ -387,7 +389,7 @@ def view_team_members(player: Player, team_id: int, **kwargs):
|
|||
class EditMemberRolesJson(BaseModel):
|
||||
roles: list[RoleSchema]
|
||||
|
||||
@api_team.patch("/id/<int:team_id>/edit-player/<int:target_player_id>")
|
||||
@api_team.patch("/id/<int:team_id>/edit-player/<target_player_id>")
|
||||
@spec.validate(
|
||||
resp=Response(
|
||||
HTTP_204=None,
|
||||
|
@ -401,9 +403,10 @@ def edit_member_roles(
|
|||
json: EditMemberRolesJson,
|
||||
player: Player,
|
||||
team_id: int,
|
||||
target_player_id: int,
|
||||
target_player_id: str,
|
||||
**kwargs,
|
||||
):
|
||||
target_player_id: int = int(target_player_id)
|
||||
target_player = db.session.query(
|
||||
PlayerTeam
|
||||
).where(
|
||||
|
|
Loading…
Reference in New Issue