feat: add events app + "multi-tenants" aka multi-events
This commit is contained in:
@@ -4,8 +4,10 @@ import { storeToRefs } from "pinia";
|
||||
import { useUserStore } from "@/stores/user";
|
||||
import { submissionsApiCreateSubmission, submissionsApiListUserSubmissions, submissionsApiCreateImageCrop, submissionsApiDeleteImageCrop, submissionsApiProcessFileOcr, submissionsApiProcessCropOcr } from "@/api";
|
||||
import { useSubmissionsWebSocket } from "@/composables/useSubmissionsWebSocket";
|
||||
import { provideEventPath } from "@/composables/useEventPath";
|
||||
|
||||
interface Props {
|
||||
eventPath: string;
|
||||
gamePath?: string;
|
||||
gameName?: string;
|
||||
gameImage?: string;
|
||||
@@ -19,6 +21,8 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
gameSteamId: "",
|
||||
});
|
||||
|
||||
provideEventPath(props.eventPath);
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
|
||||
@@ -238,7 +242,7 @@ const submitCrop = async () => {
|
||||
isCreatingCrop.value = true;
|
||||
try {
|
||||
const { data: newCrop } = await submissionsApiCreateImageCrop({
|
||||
path: { submission_file_id: selectedSubmissionFile.value.id },
|
||||
path: { event_path: props.eventPath, submission_file_id: selectedSubmissionFile.value.id },
|
||||
body: {
|
||||
x1: Math.round(currentCrop.value.x1),
|
||||
y1: Math.round(currentCrop.value.y1),
|
||||
@@ -270,7 +274,7 @@ const deleteCrop = async (cropId: string) => {
|
||||
|
||||
try {
|
||||
await submissionsApiDeleteImageCrop({
|
||||
path: { crop_id: cropId },
|
||||
path: { event_path: props.eventPath, crop_id: cropId },
|
||||
});
|
||||
selectedSubmissionFile.value.crops = selectedSubmissionFile.value.crops.filter(
|
||||
(c: any) => c.id !== cropId
|
||||
@@ -293,7 +297,7 @@ const processFileOcr = async () => {
|
||||
|
||||
try {
|
||||
await submissionsApiProcessFileOcr({
|
||||
path: { file_id: selectedSubmissionFile.value.id },
|
||||
path: { event_path: props.eventPath, file_id: selectedSubmissionFile.value.id },
|
||||
});
|
||||
selectedSubmissionFile.value.ocr_status = "processing";
|
||||
} catch (error) {
|
||||
@@ -305,7 +309,7 @@ const processFileOcr = async () => {
|
||||
const processCropOcr = async (cropId: string) => {
|
||||
try {
|
||||
await submissionsApiProcessCropOcr({
|
||||
path: { crop_id: cropId },
|
||||
path: { event_path: props.eventPath, crop_id: cropId },
|
||||
});
|
||||
// Update the crop status in the list
|
||||
if (selectedSubmissionFile.value?.crops) {
|
||||
@@ -398,6 +402,7 @@ const submitSubmission = async () => {
|
||||
isUploading.value = true;
|
||||
try {
|
||||
await submissionsApiCreateSubmission({
|
||||
path: { event_path: props.eventPath },
|
||||
query: { game_path: props.gamePath },
|
||||
body: {
|
||||
files: uploadedFiles.value,
|
||||
@@ -418,7 +423,7 @@ const submitSubmission = async () => {
|
||||
};
|
||||
|
||||
const goHome = () => {
|
||||
window.location.href = "/";
|
||||
window.location.href = `/${props.eventPath}/`;
|
||||
};
|
||||
|
||||
const formatFileSize = (bytes: number) => {
|
||||
@@ -454,6 +459,7 @@ const loadUserSubmissions = async () => {
|
||||
isLoadingSubmissions.value = true;
|
||||
try {
|
||||
const { data } = await submissionsApiListUserSubmissions({
|
||||
path: { event_path: props.eventPath },
|
||||
query: { game_path: props.gamePath },
|
||||
});
|
||||
if (data && Array.isArray(data)) {
|
||||
|
||||
Reference in New Issue
Block a user