Merge branch 'master' of gitlab.prodcontest.ru:team-15/project

This commit is contained in:
ITQ
2025-03-02 20:32:30 +03:00
7 changed files with 35 additions and 16 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ router = Router(tags=["competition"])
@router.get(
"competition/{competition_id}",
"competitions/{competition_id}",
response={
status.OK: schemas.CompetitionOut,
status.BAD_REQUEST: global_schemas.BadRequestError,
+1 -1
View File
@@ -75,7 +75,7 @@ def get_me(request):
@router.get(
path="/user/{user_id}",
path="/users/{user_id}",
response={
status.OK: UserSchema,
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='иконка достижения'),
),
]
+1 -1
View File
@@ -14,7 +14,7 @@ class Achievement(BaseModel):
max_length=30, verbose_name="название", unique=True
)
description = models.TextField(verbose_name="описание")
icon = models.FileField(
icon = models.ImageField(
verbose_name="иконка достижения",
upload_to=image_url_upload_to,
)
@@ -43,7 +43,7 @@ const TaskSolution: React.FC<TaskSolutionProps> = ({
setIsHistoryOpen(true);
};
const latestSolution = solutionHistory && solutionHistory.length > 0 ? solutionHistory[0] : null;
const latestSolution = solutionHistory && solutionHistory.length > 0 ? solutionHistory[solutionHistory.length - 1] : null;
return (
<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) => {
return await userFetch<Competition>(`/competition/${id}`);
return await userFetch<Competition>(`/competitions/${id}`);
};
export const startCompetition = async (competitionId: string) => {
+7 -7
View File
@@ -20,18 +20,18 @@ export const submitTaskSolution = async (
solution: string | File
) => {
const endpoint = `/competitions/${competitionId}/tasks/${taskId}/submit`;
if (typeof solution === 'string') {
return await userFetch(endpoint, {
method: 'POST',
body: { content: solution }
});
} else {
const formData = new FormData();
// туповатый костыль но для мвп сойдет
if (typeof solution === 'string') {
const textFile = new File([solution], 'solution.txt', { type: 'text/plain' });
formData.append('content', textFile);
} else {
formData.append('content', solution);
}
return await userFetch(endpoint, {
method: 'POST',
body: formData
});
}
};