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