admin and back fixes
This commit is contained in:
parent
eb13424f20
commit
18ca477ef1
5 changed files with 4 additions and 15 deletions
|
|
@ -29,11 +29,7 @@ function ensureQuestionIds(questions: Question[]): Question[] {
|
||||||
id: answer.id || randomUUID(),
|
id: answer.id || randomUUID(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Удаляем поле question если оно было в исходном объекте
|
|
||||||
const { question: _, ...questionWithoutQuestion } = question;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...questionWithoutQuestion,
|
|
||||||
id: questionId,
|
id: questionId,
|
||||||
text: questionText,
|
text: questionText,
|
||||||
answers: answersWithIds,
|
answers: answersWithIds,
|
||||||
|
|
@ -405,7 +401,6 @@ async function main() {
|
||||||
where: { id: theme.id },
|
where: { id: theme.id },
|
||||||
update: {
|
update: {
|
||||||
name: theme.name,
|
name: theme.name,
|
||||||
icon: theme.icon,
|
|
||||||
description: theme.description,
|
description: theme.description,
|
||||||
isPublic: theme.isPublic,
|
isPublic: theme.isPublic,
|
||||||
colors: theme.colors as any,
|
colors: theme.colors as any,
|
||||||
|
|
@ -414,7 +409,6 @@ async function main() {
|
||||||
create: {
|
create: {
|
||||||
id: theme.id,
|
id: theme.id,
|
||||||
name: theme.name,
|
name: theme.name,
|
||||||
icon: theme.icon,
|
|
||||||
description: theme.description,
|
description: theme.description,
|
||||||
isPublic: theme.isPublic,
|
isPublic: theme.isPublic,
|
||||||
createdBy: demoUser.id,
|
createdBy: demoUser.id,
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ export class AdminPacksService {
|
||||||
throw new NotFoundException('Question pack not found');
|
throw new NotFoundException('Question pack not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Нормализуем вопросы при экспорте, удаляя поле question если оно есть
|
// Нормализуем вопросы при экспорте, добавляя UUID если их нет
|
||||||
const packQuestions = Array.isArray(pack.questions) ? pack.questions as any[] : [];
|
const packQuestions = Array.isArray(pack.questions) ? pack.questions as any[] : [];
|
||||||
const normalizedQuestions = ensureQuestionIds(packQuestions);
|
const normalizedQuestions = ensureQuestionIds(packQuestions);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ export class AdminThemesService {
|
||||||
skip,
|
skip,
|
||||||
take: limit,
|
take: limit,
|
||||||
select: {
|
select: {
|
||||||
|
icon: true,
|
||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
icon: true,
|
|
||||||
description: true,
|
description: true,
|
||||||
isPublic: true,
|
isPublic: true,
|
||||||
colors: true,
|
colors: true,
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { randomUUID } from 'crypto';
|
import { randomUUID } from 'crypto';
|
||||||
|
|
||||||
interface Answer {
|
export interface Answer {
|
||||||
id?: string;
|
id?: string;
|
||||||
text: string;
|
text: string;
|
||||||
points: number;
|
points: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Question {
|
export interface Question {
|
||||||
id?: string;
|
id?: string;
|
||||||
text?: string;
|
text?: string;
|
||||||
answers: Answer[];
|
answers: Answer[];
|
||||||
|
|
@ -44,11 +44,7 @@ export function ensureQuestionIds(questions: Question[]): Question[] {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Удаляем поле question если оно было в исходном объекте
|
|
||||||
const { question: _, ...questionWithoutQuestion } = question;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...questionWithoutQuestion,
|
|
||||||
id: questionId,
|
id: questionId,
|
||||||
text: questionText,
|
text: questionText,
|
||||||
answers: answersWithIds,
|
answers: answersWithIds,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ const GameManagementModal = ({
|
||||||
onToggleParticles,
|
onToggleParticles,
|
||||||
initialTab = 'players',
|
initialTab = 'players',
|
||||||
onAddPlayer,
|
onAddPlayer,
|
||||||
room,
|
|
||||||
}) => {
|
}) => {
|
||||||
const { currentThemeData } = useTheme()
|
const { currentThemeData } = useTheme()
|
||||||
const [activeTab, setActiveTab] = useState(initialTab) // players | game | scoring | questions
|
const [activeTab, setActiveTab] = useState(initialTab) // players | game | scoring | questions
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue