mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 22:37:10 +00:00
Merge branch 'master' of gitlab.prodcontest.ru:team-15/project
This commit is contained in:
@@ -13,7 +13,7 @@ router = Router(tags=["competition"])
|
|||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"competition/{competition_id}",
|
"competitions/{competition_id}",
|
||||||
response={
|
response={
|
||||||
status.OK: schemas.CompetitionOut,
|
status.OK: schemas.CompetitionOut,
|
||||||
status.BAD_REQUEST: global_schemas.BadRequestError,
|
status.BAD_REQUEST: global_schemas.BadRequestError,
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ def get_me(request):
|
|||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
path="/user/{user_id}",
|
path="/users/{user_id}",
|
||||||
response={
|
response={
|
||||||
status.OK: UserSchema,
|
status.OK: UserSchema,
|
||||||
status.BAD_REQUEST: BadRequestError,
|
status.BAD_REQUEST: BadRequestError,
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 5.1.6 on 2025-03-02 14:03
|
||||||
|
|
||||||
|
import apps.achievement.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('achievement', '0003_remove_achievement_need_count_and_more_squashed_0004_alter_achievement_slug'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='achievement',
|
||||||
|
name='icon',
|
||||||
|
field=models.ImageField(upload_to=apps.achievement.models.Achievement.image_url_upload_to, verbose_name='иконка достижения'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -14,7 +14,7 @@ class Achievement(BaseModel):
|
|||||||
max_length=30, verbose_name="название", unique=True
|
max_length=30, verbose_name="название", unique=True
|
||||||
)
|
)
|
||||||
description = models.TextField(verbose_name="описание")
|
description = models.TextField(verbose_name="описание")
|
||||||
icon = models.FileField(
|
icon = models.ImageField(
|
||||||
verbose_name="иконка достижения",
|
verbose_name="иконка достижения",
|
||||||
upload_to=image_url_upload_to,
|
upload_to=image_url_upload_to,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
|
|||||||
setIsHistoryOpen(true);
|
setIsHistoryOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const latestSolution = solutionHistory && solutionHistory.length > 0 ? solutionHistory[0] : null;
|
const latestSolution = solutionHistory && solutionHistory.length > 0 ? solutionHistory[solutionHistory.length - 1] : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="md:w-[500px] flex flex-col gap-4">
|
<div className="md:w-[500px] flex flex-col gap-4">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const getCompetitions = async (participating?: boolean) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCompetition = async (id: string) => {
|
export const getCompetition = async (id: string) => {
|
||||||
return await userFetch<Competition>(`/competition/${id}`);
|
return await userFetch<Competition>(`/competitions/${id}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const startCompetition = async (competitionId: string) => {
|
export const startCompetition = async (competitionId: string) => {
|
||||||
|
|||||||
@@ -20,18 +20,18 @@ export const submitTaskSolution = async (
|
|||||||
solution: string | File
|
solution: string | File
|
||||||
) => {
|
) => {
|
||||||
const endpoint = `/competitions/${competitionId}/tasks/${taskId}/submit`;
|
const endpoint = `/competitions/${competitionId}/tasks/${taskId}/submit`;
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
|
// туповатый костыль но для мвп сойдет
|
||||||
if (typeof solution === 'string') {
|
if (typeof solution === 'string') {
|
||||||
return await userFetch(endpoint, {
|
const textFile = new File([solution], 'solution.txt', { type: 'text/plain' });
|
||||||
method: 'POST',
|
formData.append('content', textFile);
|
||||||
body: { content: solution }
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
const formData = new FormData();
|
formData.append('content', solution);
|
||||||
formData.append('content', solution);
|
|
||||||
|
|
||||||
return await userFetch(endpoint, {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return await userFetch(endpoint, {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
});
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user