Move matches tab to team settings

master
John Montagu, the 4th Earl of Sandvich 2024-12-11 17:20:04 -08:00
parent 52d8ea5988
commit 13fd7fdfc0
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
19 changed files with 229 additions and 80 deletions

View File

@ -21,6 +21,7 @@ export type { EventSchema } from './models/EventSchema';
export type { EventWithPlayerSchema } from './models/EventWithPlayerSchema'; export type { EventWithPlayerSchema } from './models/EventWithPlayerSchema';
export type { EventWithPlayerSchemaList } from './models/EventWithPlayerSchemaList'; export type { EventWithPlayerSchemaList } from './models/EventWithPlayerSchemaList';
export type { GetEventPlayersResponse } from './models/GetEventPlayersResponse'; export type { GetEventPlayersResponse } from './models/GetEventPlayersResponse';
export type { GetMatchQuery } from './models/GetMatchQuery';
export type { MatchSchema } from './models/MatchSchema'; export type { MatchSchema } from './models/MatchSchema';
export type { PlayerEventRolesSchema } from './models/PlayerEventRolesSchema'; export type { PlayerEventRolesSchema } from './models/PlayerEventRolesSchema';
export type { PlayerRoleSchema } from './models/PlayerRoleSchema'; export type { PlayerRoleSchema } from './models/PlayerRoleSchema';

View File

@ -0,0 +1,8 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type GetMatchQuery = {
limit: (number | null);
};

View File

@ -5,7 +5,7 @@
export type MatchSchema = { export type MatchSchema = {
blueScore: number; blueScore: number;
createdAt: string; createdAt: string;
duration: string; duration: number;
logsTfId: number; logsTfId: number;
logsTfTitle: string; logsTfTitle: string;
matchTime: string; matchTime: string;

View File

@ -4,5 +4,6 @@
/* eslint-disable */ /* eslint-disable */
export type SubmitMatchJson = { export type SubmitMatchJson = {
matchIds: Array<number>; matchIds: Array<number>;
teamId: number;
}; };

View File

@ -6,6 +6,7 @@ import type { MatchSchema } from './MatchSchema';
export type TeamMatchSchema = { export type TeamMatchSchema = {
match: MatchSchema; match: MatchSchema;
ourScore: number; ourScore: number;
teamColor: string;
theirScore: number; theirScore: number;
}; };

View File

@ -348,11 +348,13 @@ export class DefaultService {
/** /**
* get_matches_for_team <GET> * get_matches_for_team <GET>
* @param teamId * @param teamId
* @param limit
* @returns TeamMatchSchemaList OK * @returns TeamMatchSchemaList OK
* @throws ApiError * @throws ApiError
*/ */
public getMatchesForTeam( public getMatchesForTeam(
teamId: number, teamId: number,
limit: (number | null),
): CancelablePromise<TeamMatchSchemaList> { ): CancelablePromise<TeamMatchSchemaList> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'GET', method: 'GET',
@ -360,6 +362,9 @@ export class DefaultService {
path: { path: {
'team_id': teamId, 'team_id': teamId,
}, },
query: {
'limit': limit,
},
errors: { errors: {
422: `Unprocessable Content`, 422: `Unprocessable Content`,
}, },
@ -520,7 +525,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public deleteTeam( public deleteTeam(
teamId: string, teamId: number,
): CancelablePromise<any> { ): CancelablePromise<any> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'DELETE', method: 'DELETE',
@ -542,7 +547,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public getTeam( public getTeam(
teamId: string, teamId: number,
): CancelablePromise<ViewTeamResponse> { ): CancelablePromise<ViewTeamResponse> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'GET', method: 'GET',
@ -590,8 +595,8 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public editMemberRoles( public editMemberRoles(
teamId: string, teamId: number,
targetPlayerId: string, targetPlayerId: number,
requestBody?: EditMemberRolesJson, requestBody?: EditMemberRolesJson,
): CancelablePromise<void> { ): CancelablePromise<void> {
return this.httpRequest.request({ return this.httpRequest.request({
@ -617,7 +622,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public getIntegrations( public getIntegrations(
teamId: string, teamId: number,
): CancelablePromise<TeamIntegrationSchema> { ): CancelablePromise<TeamIntegrationSchema> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'GET', method: 'GET',
@ -638,7 +643,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public updateIntegrations( public updateIntegrations(
teamId: string, teamId: number,
requestBody?: TeamIntegrationSchema, requestBody?: TeamIntegrationSchema,
): CancelablePromise<TeamIntegrationSchema> { ): CancelablePromise<TeamIntegrationSchema> {
return this.httpRequest.request({ return this.httpRequest.request({
@ -661,7 +666,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public getInvites( public getInvites(
teamId: string, teamId: number,
): CancelablePromise<TeamInviteSchemaList> { ): CancelablePromise<TeamInviteSchemaList> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'GET', method: 'GET',
@ -682,7 +687,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public createInvite( public createInvite(
teamId: string, teamId: number,
): CancelablePromise<TeamInviteSchema> { ): CancelablePromise<TeamInviteSchema> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'POST', method: 'POST',
@ -704,7 +709,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public revokeInvite( public revokeInvite(
teamId: string, teamId: number,
key: string, key: string,
): CancelablePromise<void> { ): CancelablePromise<void> {
return this.httpRequest.request({ return this.httpRequest.request({
@ -729,8 +734,8 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public createOrUpdatePlayer( public createOrUpdatePlayer(
teamId: string, teamId: number,
playerId: string, playerId: number,
requestBody?: AddPlayerJson, requestBody?: AddPlayerJson,
): CancelablePromise<any> { ): CancelablePromise<any> {
return this.httpRequest.request({ return this.httpRequest.request({
@ -757,8 +762,8 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public removePlayerFromTeam( public removePlayerFromTeam(
teamId: string, teamId: number,
targetPlayerId: string, targetPlayerId: number,
): CancelablePromise<any> { ): CancelablePromise<any> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'DELETE', method: 'DELETE',
@ -781,7 +786,7 @@ export class DefaultService {
* @throws ApiError * @throws ApiError
*/ */
public getTeamMembers( public getTeamMembers(
teamId: string, teamId: number,
): CancelablePromise<ViewTeamMembersResponseList> { ): CancelablePromise<ViewTeamMembersResponseList> {
return this.httpRequest.request({ return this.httpRequest.request({
method: 'GET', method: 'GET',

View File

@ -1,10 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { useTeamDetails } from "@/composables/team-details";
import { useMatchesStore } from "@/stores/matches"; import { useMatchesStore } from "@/stores/matches";
import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger } from "radix-vue"; import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger } from "radix-vue";
import { ref } from "vue"; import { ref } from "vue";
const matchesStore = useMatchesStore(); const matchesStore = useMatchesStore();
const { teamId } = useTeamDetails();
const urlsText = ref(""); const urlsText = ref("");
function submit() { function submit() {
@ -15,7 +18,10 @@ function submit() {
}) })
.filter((id) => !isNaN(id)); .filter((id) => !isNaN(id));
matchesStore.submitMatches(ids); matchesStore.submitMatches(ids, teamId.value)
.then(() => {
urlsText.value = "";
});
} }
</script> </script>

View File

@ -28,7 +28,7 @@ function disableIntegration() {
<template> <template>
<h2>logs.tf Auto-Tracking</h2> <h2>logs.tf Auto-Tracking</h2>
<p>Automatically fetch and track match history from logs.tf. (CURRENTLY NOT IMPLEMENTED)</p> <p>Automatically fetch and track match history from logs.tf.</p>
<div v-if="model"> <div v-if="model">
<div class="form-group margin"> <div class="form-group margin">
<h3>logs.tf API key (optional)</h3> <h3>logs.tf API key (optional)</h3>

View File

@ -1,37 +1,91 @@
<script setup lang="ts"> <script setup lang="ts">
import type { TeamMatchSchema, TeamSchema } from '@/client';
import moment from 'moment';
import { computed } from 'vue';
const matchTime = computed(() => moment(props.teamMatch.match.matchTime)
.format("LL LT"));
const props = defineProps<{
team: TeamSchema,
teamMatch: TeamMatchSchema,
}>();
</script> </script>
<template> <template>
<div class="match-card"> <div class="match-card">
<div class="match-title">
<h3>
{{ teamMatch.match.logsTfTitle }}
</h3>
</div>
<div class="match-scores"> <div class="match-scores">
<div class="team-and-score"> <div class="team-and-score">
<span class="team-name"> <span class="team-name">
NVBLU <span v-if="teamMatch.teamColor == 'Blue'">
BLU
</span>
<span v-else>
RED
</span>
</span> </span>
<span class="score"> <span class="score">
3 {{ teamMatch.ourScore }}
</span> </span>
</div> </div>
<span class="score">-</span>
<div class="team-and-score"> <div class="team-and-score">
<span class="score"> <span class="score">
2 {{ teamMatch.theirScore }}
</span> </span>
<span class="team-name"> <span class="team-name">
RED <span v-if="teamMatch.teamColor == 'Blue'">
RED
</span>
<span v-else>
BLU
</span>
</span> </span>
</div> </div>
</div> </div>
<div class="bottom-row">
<div class="subtext">
{{ matchTime }}
</div>
<div>
<a :href="'https://logs.tf/' + teamMatch.match.logsTfId" target="_blank" class="button">
#{{ teamMatch.match.logsTfId }}
</a>
</div>
</div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.match-card { .match-card {
display: flex; display: flex;
justify-content: space-between; flex-direction: column;
padding: 1rem; padding: 1rem;
border: 1px solid var(--text); border: 1px solid var(--text);
border-radius: 8px; border-radius: 8px;
gap: 0.5rem;
}
.match-title {
display: flex;
gap: 0.5rem;
align-items: center;
}
.bottom-row {
display: flex;
justify-content: space-between;
align-items: center;
}
.bottom-row > div {
display: flex;
align-items: center;
gap: 1rem;
} }
.match-scores { .match-scores {

View File

@ -11,8 +11,8 @@ import TeamSettingsView from "@/views/TeamSettingsView.vue";
import TeamSettingsGeneralView from "@/views/TeamSettings/GeneralView.vue"; import TeamSettingsGeneralView from "@/views/TeamSettings/GeneralView.vue";
import TeamSettingsIntegrationsView from "@/views/TeamSettings/IntegrationsView.vue"; import TeamSettingsIntegrationsView from "@/views/TeamSettings/IntegrationsView.vue";
import TeamSettingsInvitesView from "@/views/TeamSettings/InvitesView.vue"; import TeamSettingsInvitesView from "@/views/TeamSettings/InvitesView.vue";
import TeamSettingsMatchesView from "@/views/TeamSettings/MatchesView.vue";
import UserSettingsView from "@/views/UserSettingsView.vue"; import UserSettingsView from "@/views/UserSettingsView.vue";
import MatchesView from "@/views/MatchesView.vue";
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
@ -72,6 +72,11 @@ const router = createRouter({
name: "team-settings/invites", name: "team-settings/invites",
component: TeamSettingsInvitesView, component: TeamSettingsInvitesView,
}, },
{
path: "matches",
name: "team-settings/matches",
component: TeamSettingsMatchesView,
},
], ],
}, },
{ {
@ -79,11 +84,6 @@ const router = createRouter({
name: "user-settings", name: "user-settings",
component: UserSettingsView, component: UserSettingsView,
}, },
{
path: "/matches",
name: "matches",
component: MatchesView,
},
] ]
}); });

View File

@ -9,7 +9,9 @@ export const useMatchesStore = defineStore("matches", () => {
const matches = ref<{ [id: number]: MatchSchema }>({ }); const matches = ref<{ [id: number]: MatchSchema }>({ });
const teamMatches = ref<{ [id: number]: TeamMatchSchema }>({ }); const teamMatches = ref<{ [teamId: number]: TeamMatchSchema[] }>({ });
const recentMatches = ref<TeamMatchSchema[]>([]);
function fetchMatches() { function fetchMatches() {
return clientStore.call( return clientStore.call(
@ -18,21 +20,52 @@ export const useMatchesStore = defineStore("matches", () => {
(response) => { (response) => {
response.forEach((match) => { response.forEach((match) => {
matches.value[match.match.logsTfId] = match.match; matches.value[match.match.logsTfId] = match.match;
teamMatches.value[match.match.logsTfId] = match; //teamMatches.value[match.match.logsTfId] = match;
}); });
return response; return response;
} }
) )
} }
function submitMatches(logsTfIds: number[]) { function fetchMatchesForTeam(teamId: number) {
return client.default.submitMatch({ matchIds: logsTfIds }); return clientStore.call(
fetchMatchesForTeam.name,
() => client.default.getMatchesForTeam(teamId, 1024),
(response) => {
teamMatches.value[teamId] = [];
response.forEach((match) => {
matches.value[match.match.logsTfId] = match.match;
teamMatches.value[teamId].push(match);
});
return response;
});
}
function fetchRecentMatchesForTeam(teamId: number, limit: number) {
return clientStore.call(
fetchMatchesForTeam.name,
() => client.default.getMatchesForTeam(teamId, limit),
(response) => {
recentMatches.value = [];
response.forEach((match) => {
matches.value[match.match.logsTfId] = match.match;
recentMatches.value.push(match);
});
return response;
});
}
function submitMatches(logsTfIds: number[], teamId: number) {
return client.default.submitMatch({ matchIds: logsTfIds, teamId });
} }
return { return {
matches, matches,
teamMatches, teamMatches,
recentMatches,
fetchMatches, fetchMatches,
fetchMatchesForTeam,
fetchRecentMatchesForTeam,
submitMatches, submitMatches,
} }
}); });

View File

@ -9,10 +9,12 @@ import moment from "moment";
import EventList from "@/components/EventList.vue"; import EventList from "@/components/EventList.vue";
import { useTeamsEventsStore } from "@/stores/teams/events"; import { useTeamsEventsStore } from "@/stores/teams/events";
import MatchCard from "@/components/MatchCard.vue"; import MatchCard from "@/components/MatchCard.vue";
import { useMatchesStore } from "@/stores/matches";
const route = useRoute(); const route = useRoute();
const teamsStore = useTeamsStore(); const teamsStore = useTeamsStore();
const invitesStore = useInvitesStore(); const invitesStore = useInvitesStore();
const matchesStore = useMatchesStore();
const { team, teamId } = useTeamDetails(); const { team, teamId } = useTeamDetails();
const creationDate = computed(() => { const creationDate = computed(() => {
@ -25,6 +27,7 @@ const key = computed(() => route.query.key);
const teamsEventsStore = useTeamsEventsStore(); const teamsEventsStore = useTeamsEventsStore();
const events = computed(() => teamsEventsStore.teamEvents[teamId.value]); const events = computed(() => teamsEventsStore.teamEvents[teamId.value]);
const matches = computed(() => matchesStore.recentMatches);
onMounted(() => { onMounted(() => {
let doFetchTeam = () => { let doFetchTeam = () => {
@ -32,6 +35,7 @@ onMounted(() => {
.then(() => { .then(() => {
teamsStore.fetchTeamMembers(teamId.value); teamsStore.fetchTeamMembers(teamId.value);
teamsEventsStore.fetchTeamEvents(teamId.value); teamsEventsStore.fetchTeamEvents(teamId.value);
matchesStore.fetchRecentMatchesForTeam(teamId.value, 5);
}); });
}; };
@ -76,14 +80,21 @@ onMounted(() => {
<EventList :events="events" :team-context="team" /> <EventList :events="events" :team-context="team" />
<h2 id="recent-matches-header"> <h2 id="recent-matches-header">
Recent Matches Recent Matches
<!--RouterLink class="button" to="/"> <RouterLink class="button" :to="{ name: 'team-settings/matches' }">
<button class="icon" v-tooltip="'View all'"> <button class="icon" v-tooltip="'View all'">
<i class="bi bi-arrow-right-circle-fill"></i> <i class="bi bi-arrow-right-circle-fill"></i>
</button> </button>
</RouterLink--> </RouterLink>
</h2> </h2>
<em class="subtext" v-if="true">No recent matches.</em> <em class="subtext" v-if="!matches">
<MatchCard v-else /> No recent matches.
</em>
<MatchCard
v-else
v-for="match in matches"
:team-match="match"
:team="team"
/>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,12 +1,21 @@
<script setup lang="ts"> <script setup lang="ts">
import AddMatchDialog from "@/components/AddMatchDialog.vue"; import AddMatchDialog from "@/components/AddMatchDialog.vue";
import { useTeamDetails } from "@/composables/team-details";
import { useMatchesStore } from "@/stores/matches"; import { useMatchesStore } from "@/stores/matches";
import { onMounted } from "vue"; import { useTeamsStore } from "@/stores/teams";
import moment from "moment";
import { computed, onMounted } from "vue";
const matchesStore = useMatchesStore(); const matchesStore = useMatchesStore();
const teamsStore = useTeamsStore();
const { team, teamId } = useTeamDetails();
const matches = computed(() => matchesStore.teamMatches[teamId.value]);
onMounted(() => { onMounted(() => {
matchesStore.fetchMatches(); teamsStore.fetchTeam(teamId.value)
.then(() => matchesStore.fetchMatchesForTeam(teamId.value));
}); });
</script> </script>
@ -15,7 +24,7 @@ onMounted(() => {
<div class="header"> <div class="header">
<h1> <h1>
<i class="bi bi-trophy-fill margin"></i> <i class="bi bi-trophy-fill margin"></i>
Matches you've played Matches
</h1> </h1>
<div class="button-group"> <div class="button-group">
<AddMatchDialog /> <AddMatchDialog />
@ -26,18 +35,20 @@ onMounted(() => {
<tr> <tr>
<th>RED</th> <th>RED</th>
<th>BLU</th> <th>BLU</th>
<th>Team</th>
<th>Match Date</th> <th>Match Date</th>
<th>logs.tf URL</th> <th>logs.tf URL</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="match in matchesStore.matches" :key="match.logsTfId"> <tr v-for="teamMatch in matches">
<td>{{ match.redScore }}</td> <td>{{ teamMatch.match.redScore }}</td>
<td>{{ match.blueScore }}</td> <td>{{ teamMatch.match.blueScore }}</td>
<td>{{ match.matchTime }}</td> <td>{{ teamMatch.teamColor == 'Blue' ? 'BLU' : 'RED' }}</td>
<td>{{ moment(teamMatch.match.matchTime).format("LL LT") }}</td>
<td> <td>
<a :href="`https://logs.tf/${match.logsTfId}`" target="_blank"> <a :href="`https://logs.tf/${teamMatch.match.logsTfId}`" target="_blank">
#{{ match.logsTfId }} #{{ teamMatch.match.logsTfId }}
</a> </a>
</td> </td>
</tr> </tr>

View File

@ -42,6 +42,9 @@ onMounted(() => {
<RouterLink class="tab" :to="{ name: 'team-settings/invites' }"> <RouterLink class="tab" :to="{ name: 'team-settings/invites' }">
Invites Invites
</RouterLink> </RouterLink>
<RouterLink class="tab" :to="{ name: 'team-settings/matches' }">
Matches
</RouterLink>
<hr> <hr>
<button class="destructive-on-hover icon-end" @click="leaveTeam"> <button class="destructive-on-hover icon-end" @click="leaveTeam">
Leave team Leave team

View File

@ -1,3 +1,4 @@
from typing import Optional
from flask import Blueprint, abort from flask import Blueprint, abort
from pydantic.v1 import validator from pydantic.v1 import validator
#from pydantic.functional_validators import field_validator #from pydantic.functional_validators import field_validator
@ -41,6 +42,7 @@ def get_match(player: Player, match_id: int, **_):
class SubmitMatchJson(BaseModel): class SubmitMatchJson(BaseModel):
match_ids: list[int] match_ids: list[int]
team_id: int
@validator("match_ids") @validator("match_ids")
@classmethod @classmethod
@ -59,15 +61,13 @@ class SubmitMatchJson(BaseModel):
) )
@requires_authentication @requires_authentication
def submit_match(json: SubmitMatchJson, **_): def submit_match(json: SubmitMatchJson, **_):
import sys
print(json, file=sys.stderr)
if json.match_ids is None:
print("json.match_ids is None", file=sys.stderr)
for id in json.match_ids: for id in json.match_ids:
load_specific_match.delay(id, None) load_specific_match.delay(id, json.team_id)
return { }, 204 return { }, 204
class GetMatchQuery(BaseModel):
limit: Optional[int]
@api_match.get("/team/<int:team_id>") @api_match.get("/team/<int:team_id>")
@spec.validate( @spec.validate(
resp=Response( resp=Response(
@ -77,14 +77,19 @@ def submit_match(json: SubmitMatchJson, **_):
) )
@requires_authentication @requires_authentication
@requires_team_membership() @requires_team_membership()
def get_matches_for_team(team_id: Team, **_): def get_matches_for_team(team_id: Team, query: GetMatchQuery, **_):
matches = ( q = (
db.session.query(TeamMatch) db.session.query(TeamMatch)
.where(TeamMatch.team_id == team_id) .where(TeamMatch.team_id == team_id)
.options(joinedload(TeamMatch.match)) .options(joinedload(TeamMatch.match))
.all() .order_by(TeamMatch.match_id.desc())
) )
if query and query.limit:
q = q.limit(query.limit)
matches = q.all()
return [TeamMatchSchema.from_model(match).dict(by_alias=True) for match in matches], 200 return [TeamMatchSchema.from_model(match).dict(by_alias=True) for match in matches], 200
@api_match.get("/player") @api_match.get("/player")

View File

@ -19,6 +19,7 @@ class TeamMatchSchema(spec.BaseModel):
match: "MatchSchema" match: "MatchSchema"
our_score: int our_score: int
their_score: int their_score: int
team_color: str
@classmethod @classmethod
def from_model(cls, model: "TeamMatch"): def from_model(cls, model: "TeamMatch"):
@ -29,6 +30,7 @@ class TeamMatchSchema(spec.BaseModel):
match=MatchSchema.from_model(model.match), match=MatchSchema.from_model(model.match),
our_score=our_score, our_score=our_score,
their_score=their_score, their_score=their_score,
team_color=model.team_color,
) )

View File

@ -51,6 +51,8 @@ services:
context: ./availabili.tf context: ./availabili.tf
environment: environment:
VITE_API_URL: http://localhost:8000 # API endpoint VITE_API_URL: http://localhost:8000 # API endpoint
ports:
- 5173:5173
volumes: volumes:
- ./availabili.tf:/app - ./availabili.tf:/app
networks: networks:
@ -62,7 +64,7 @@ services:
ports: ports:
- "8000:80" - "8000:80"
volumes: volumes:
- ./nginx:/etc/nginx/conf.d - ./nginx/development.conf:/etc/nginx/nginx.conf
depends_on: depends_on:
- backend - backend
- frontend - frontend

View File

@ -1,24 +0,0 @@
server {
listen 80;
# Proxy for the Vite frontend
location / {
proxy_pass http://frontend:5173;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Proxy for the Flask backend API
location /api/ {
proxy_pass http://backend:5000;
proxy_set_header Host $host;
}
location /apidoc/ {
proxy_pass http://backend:5000;
proxy_set_header Host $host;
}
}

View File

@ -0,0 +1,30 @@
events {
worker_connections 1024;
}
http {
server {
listen 80;
# Proxy for the Vite frontend
location / {
proxy_pass http://frontend:5173;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Proxy for the Flask backend API
location /api/ {
proxy_pass http://backend:5000;
proxy_set_header Host $host;
}
location /apidoc/ {
proxy_pass http://backend:5000;
proxy_set_header Host $host;
}
}
}