Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9509f12d73 | ||
|
|
021031ced7 | ||
|
|
22a9199d9d | ||
|
|
e56f0e4e5d | ||
|
|
5c13ca1cac | ||
|
|
56e07bc2ef | ||
|
|
923f7034dd | ||
|
|
fd422da06f | ||
|
|
0034704af6 | ||
|
|
3dfd854a4c | ||
|
|
6b903b4d54 | ||
|
|
c3de9692d8 | ||
|
|
b2898ef4b3 | ||
|
|
26c8a477c3 | ||
|
|
c9a64ccbef | ||
|
|
250feff2f4 | ||
|
|
efc359ce7e | ||
|
|
5911cdf8a8 | ||
|
|
a8195cd627 | ||
|
|
52b60ed1f5 |
@@ -9,6 +9,9 @@ module.exports = {
|
||||
},
|
||||
navigations: {
|
||||
'journal.main': '/journal.pl',
|
||||
'exam.main': '/exam',
|
||||
'link.exam.details': '/details/:courseId/:examId',
|
||||
'link.journal.attendance': '/attendance/:courseId',
|
||||
},
|
||||
features: {
|
||||
journal: {
|
||||
|
||||
12
openapi-config.ts
Normal file
12
openapi-config.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { ConfigFile } from '@rtk-query/codegen-openapi'
|
||||
|
||||
const config: ConfigFile = {
|
||||
schemaFile: 'https://platform.bro-js.ru/jrnl-bh/documentation/json',
|
||||
apiFile: './src/__data__/api/api.ts',
|
||||
apiImport: 'api',
|
||||
outputFile: './src/__data__/api/jrnl.ts',
|
||||
exportName: 'jrnlApi',
|
||||
hooks: true,
|
||||
}
|
||||
|
||||
export default config
|
||||
1189
package-lock.json
generated
1189
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "journal.pl",
|
||||
"version": "3.1.2",
|
||||
"version": "3.5.1",
|
||||
"description": "bro-js platform journal ui repo",
|
||||
"main": "./src/index.tsx",
|
||||
"scripts": {
|
||||
@@ -19,13 +19,14 @@
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@rtk-query/codegen-openapi": "^1.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
||||
"@typescript-eslint/parser": "^7.4.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-react": "^7.34.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@brojs/cli": "^0.0.4-alpha.10",
|
||||
"@brojs/cli": "^0.0.4-beta.0",
|
||||
"@chakra-ui/icons": "^2.1.1",
|
||||
"@chakra-ui/react": "^2.8.2",
|
||||
"@emotion/react": "^11.11.4",
|
||||
@@ -47,6 +48,7 @@
|
||||
"react-redux": "^9.1.0",
|
||||
"react-router-dom": "^6.22.1",
|
||||
"redux": "^5.0.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.3.3",
|
||||
"webpack-hot-middleware": "^2.26.1"
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
BaseResponse,
|
||||
Course,
|
||||
Lesson,
|
||||
PopulatedCourse,
|
||||
User,
|
||||
UserData,
|
||||
} from '../model'
|
||||
@@ -32,7 +33,7 @@ export const api = createApi({
|
||||
headers.set('Authorization', `Bearer ${keycloak.token}`)
|
||||
},
|
||||
}),
|
||||
tagTypes: ['LessonList', 'CourseList'],
|
||||
tagTypes: ['LessonList', 'CourseList', 'Course'],
|
||||
endpoints: (builder) => ({
|
||||
coursesList: builder.query<BaseResponse<Course[]>, void>({
|
||||
query: () => '/course/list',
|
||||
@@ -78,7 +79,7 @@ export const api = createApi({
|
||||
}),
|
||||
invalidatesTags: ['LessonList'],
|
||||
}),
|
||||
updateLesson: builder.mutation<BaseResponse<Lesson>, Partial<Lesson> & Pick<Lesson, '_id'>>({
|
||||
updateLesson: builder.mutation<BaseResponse<Lesson>, Partial<Lesson> & Pick<Lesson, 'id'>>({
|
||||
query: (data) => ({
|
||||
method: 'PUT',
|
||||
url: '/lesson',
|
||||
@@ -116,5 +117,18 @@ export const api = createApi({
|
||||
method: 'GET',
|
||||
}),
|
||||
}),
|
||||
getCourseById: builder.query<PopulatedCourse, string>({
|
||||
query: (courseId) => `/course/${courseId}`,
|
||||
transformResponse: (response: BaseResponse<PopulatedCourse>) => response.body,
|
||||
providesTags: ['Course'],
|
||||
}),
|
||||
toggleExamWithJury: builder.mutation<void, string>({
|
||||
query: (courseId) => ({
|
||||
url: `/course/toggle-exam-with-jury/${courseId}`,
|
||||
method: 'POST',
|
||||
body: {},
|
||||
}),
|
||||
invalidatesTags: ['Course']
|
||||
})
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -50,7 +50,7 @@ export type BaseResponse<Data> = {
|
||||
};
|
||||
|
||||
export interface Lesson {
|
||||
_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
students: User[];
|
||||
date: string;
|
||||
@@ -79,10 +79,46 @@ export interface User {
|
||||
|
||||
export interface Course {
|
||||
_id: string;
|
||||
id: string;
|
||||
name: string;
|
||||
teachers: User[];
|
||||
lessons: Lesson[];
|
||||
lessons: string[];
|
||||
creator: User;
|
||||
startDt: string;
|
||||
examWithJury?: string;
|
||||
created: string;
|
||||
}
|
||||
|
||||
export interface PopulatedCourse extends Omit<Course, 'examWithJury' | 'lessons'> {
|
||||
examWithJury: ExamWithJury;
|
||||
lessons: Lesson[];
|
||||
}
|
||||
|
||||
interface ExamWithJury {
|
||||
name: string;
|
||||
description: string;
|
||||
jury: any[];
|
||||
date: string;
|
||||
created: string;
|
||||
criterias: Criteria[][];
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface Criteria {
|
||||
title: string;
|
||||
type?: string;
|
||||
min?: number;
|
||||
max?: number;
|
||||
wight?: number;
|
||||
subcriterias?: Subcriteria[];
|
||||
}
|
||||
|
||||
interface Subcriteria {
|
||||
title: string;
|
||||
type: string;
|
||||
wight: number;
|
||||
trueText?: string;
|
||||
falseText?: string;
|
||||
min?: number;
|
||||
max?: number;
|
||||
}
|
||||
26
src/components/error-boundary/index.tsx
Normal file
26
src/components/error-boundary/index.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Alert } from '@chakra-ui/react'
|
||||
import React from 'react'
|
||||
|
||||
export class ErrorBoundary extends React.Component<
|
||||
React.PropsWithChildren,
|
||||
{ hasError: boolean, error?: string }
|
||||
> {
|
||||
state = { hasError: false, error: null }
|
||||
|
||||
static getDerivedStateFromError(error: Error) {
|
||||
return { hasError: true, error: error.message }
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
return (
|
||||
<Alert status="error" title="Ошибка">
|
||||
Что-то пошло не так<br />
|
||||
{this.state.error && <span>{this.state.error}</span>}
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
|
||||
return this.props.children
|
||||
}
|
||||
}
|
||||
20
src/components/page-loader/page-loader.tsx
Normal file
20
src/components/page-loader/page-loader.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import React from 'react'
|
||||
import {
|
||||
Spinner,
|
||||
Container,
|
||||
Center,
|
||||
} from '@chakra-ui/react'
|
||||
|
||||
export const PageLoader = () => (
|
||||
<Container maxW="container.xl">
|
||||
<Center h="300px">
|
||||
<Spinner
|
||||
thickness="4px"
|
||||
speed="0.65s"
|
||||
emptyColor="gray.200"
|
||||
color="blue.500"
|
||||
size="xl"
|
||||
/>
|
||||
</Center>
|
||||
</Container>
|
||||
)
|
||||
@@ -9,11 +9,14 @@ import {
|
||||
LessonDetailsPage,
|
||||
LessonListPage,
|
||||
UserPage,
|
||||
AttendancePage,
|
||||
} from './pages'
|
||||
import { ErrorBoundary } from './components/error-boundary'
|
||||
|
||||
const Wrapper = ({ children }: { children: React.ReactElement }) => (
|
||||
<Suspense
|
||||
fallback={
|
||||
<ErrorBoundary>
|
||||
<Container>
|
||||
<VStack>
|
||||
<Box mt="150">
|
||||
@@ -23,9 +26,11 @@ const Wrapper = ({ children }: { children: React.ReactElement }) => (
|
||||
emptyColor="gray.200"
|
||||
color="blue.500"
|
||||
size="xl"
|
||||
/></Box>
|
||||
/>
|
||||
</Box>
|
||||
</VStack>
|
||||
</Container>
|
||||
</ErrorBoundary>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
@@ -67,6 +72,14 @@ export const Dashboard = ({ store }) => (
|
||||
</Wrapper>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={`${getNavigationsValue('journal.main')}${getNavigationsValue('link.journal.attendance')}`}
|
||||
element={
|
||||
<Wrapper>
|
||||
<AttendancePage />
|
||||
</Wrapper>
|
||||
}
|
||||
/>
|
||||
</Routes>
|
||||
</Provider>
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable react/display-name */
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
|
||||
@@ -24,7 +25,7 @@ export const mount = async (Сomponent, element = document.getElementById('app')
|
||||
}
|
||||
const store = createStore({ user });
|
||||
|
||||
const rootElement = ReactDOM.createRoot(element);
|
||||
rootElement = ReactDOM.createRoot(element);
|
||||
rootElement.render(<Сomponent store={store} />);
|
||||
|
||||
if(module.hot) {
|
||||
|
||||
109
src/pages/attendance/attendance.tsx
Normal file
109
src/pages/attendance/attendance.tsx
Normal file
@@ -0,0 +1,109 @@
|
||||
import React, { useMemo } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { Box, Heading, Tooltip, Text } from '@chakra-ui/react'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
import { api } from '../../__data__/api/api'
|
||||
import { PageLoader } from '../../components/page-loader/page-loader'
|
||||
|
||||
export const Attendance = () => {
|
||||
const { courseId } = useParams()
|
||||
const { data: attendance, isLoading } = api.useLessonListQuery(courseId, {
|
||||
selectFromResult: ({ data, isLoading }) => ({
|
||||
data: data?.body,
|
||||
isLoading,
|
||||
}),
|
||||
})
|
||||
const { data: courseInfo, isLoading: courseInfoIssLoading } =
|
||||
api.useGetCourseByIdQuery(courseId)
|
||||
|
||||
const data = useMemo(() => {
|
||||
if (!attendance) return null
|
||||
|
||||
const studentsMap = new Map()
|
||||
|
||||
attendance.forEach((lesson) => {
|
||||
lesson.students.forEach((student) => {
|
||||
studentsMap.set(student.sub, {
|
||||
...student,
|
||||
value:
|
||||
student.family_name && student.given_name
|
||||
? `${student.family_name} ${student.given_name}`
|
||||
: student.name || student.email,
|
||||
})
|
||||
})
|
||||
})
|
||||
const compare = Intl.Collator('ru').compare
|
||||
|
||||
const students = [...studentsMap.values()]
|
||||
students.sort(({ family_name: name }, { family_name: nname }) =>
|
||||
compare(name, nname),
|
||||
)
|
||||
return {
|
||||
students,
|
||||
}
|
||||
}, [attendance])
|
||||
|
||||
if (!data || isLoading || courseInfoIssLoading) {
|
||||
return <PageLoader />
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Box mt={12} mb={12}>
|
||||
<Heading>{courseInfo.name}</Heading>
|
||||
</Box>
|
||||
<Box>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Дата</th>
|
||||
<th>Название занятия</th>
|
||||
{data.students.map((student) => (
|
||||
<th key={student.sub}>{student.name}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{attendance.map((lesson, index) => (
|
||||
<tr key={lesson.name}>
|
||||
<td>{dayjs(lesson.date).format('DD.MM.YYYY')}</td>
|
||||
<td>{<ShortText text={lesson.name} />}</td>
|
||||
|
||||
{data.students.map((st) => {
|
||||
const wasThere =
|
||||
lesson.students.findIndex((u) => u.sub === st.sub) !== -1
|
||||
return (
|
||||
<td
|
||||
style={{
|
||||
textAlign: 'center',
|
||||
backgroundColor: wasThere ? '#8ef78a' : '#e09797',
|
||||
}}
|
||||
key={st.sub}
|
||||
>
|
||||
{wasThere ? '+' : '-'}
|
||||
</td>
|
||||
)
|
||||
})}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
const ShortText = ({ text }: { text: string }) => {
|
||||
const needShortText = text.length > 20
|
||||
|
||||
if (needShortText) {
|
||||
return (
|
||||
<Tooltip label="На страницу с лекциями" fontSize="12px" top="16px">
|
||||
<Text>{text.slice(0, 20)}...</Text>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
return text
|
||||
}
|
||||
3
src/pages/attendance/index.ts
Normal file
3
src/pages/attendance/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Attendance } from './attendance'
|
||||
|
||||
export default Attendance
|
||||
121
src/pages/course-list/course-card.tsx
Normal file
121
src/pages/course-list/course-card.tsx
Normal file
@@ -0,0 +1,121 @@
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import dayjs from 'dayjs'
|
||||
import { Link as ConnectedLink, generatePath } from 'react-router-dom'
|
||||
import { getNavigationsValue } from '@brojs/cli'
|
||||
import {
|
||||
Box,
|
||||
CardHeader,
|
||||
CardBody,
|
||||
CardFooter,
|
||||
ButtonGroup,
|
||||
Stack,
|
||||
StackDivider,
|
||||
Button,
|
||||
Card,
|
||||
Heading,
|
||||
Tooltip,
|
||||
Spinner,
|
||||
} from '@chakra-ui/react'
|
||||
|
||||
import { api } from '../../__data__/api/api'
|
||||
import { ArrowUpIcon, LinkIcon } from '@chakra-ui/icons'
|
||||
import { Course } from '../../__data__/model'
|
||||
import { CourseDetails } from './course-details'
|
||||
|
||||
export const CourseCard = ({ course }: { course: Course }) => {
|
||||
const [getLessonList, populatedCourse] = api.useLazyGetCourseByIdQuery()
|
||||
const [isOpened, setIsOpened] = useState(false)
|
||||
useEffect(() => {
|
||||
if (isOpened) {
|
||||
getLessonList(course.id, true)
|
||||
}
|
||||
}, [isOpened])
|
||||
|
||||
const handleToggleOpene = useCallback(() => {
|
||||
setIsOpened((opened) => !opened)
|
||||
}, [setIsOpened])
|
||||
|
||||
return (
|
||||
<Card key={course._id} align="left">
|
||||
<CardHeader>
|
||||
<Heading as="h2" mt="0">
|
||||
{course.name}
|
||||
</Heading>
|
||||
</CardHeader>
|
||||
{isOpened && (
|
||||
<CardBody mt="16px">
|
||||
<Stack divider={<StackDivider />} spacing="8px">
|
||||
<Box as="span" textAlign="left">
|
||||
{`Дата начала курса - ${dayjs(course.startDt).format('DD MMMM YYYYг.')}`}
|
||||
</Box>
|
||||
<Box as="span" textAlign="left">
|
||||
Количество занятий - {course.lessons.length}
|
||||
</Box>
|
||||
|
||||
{populatedCourse.isFetching && <Spinner />}
|
||||
{!populatedCourse.isFetching && populatedCourse.isSuccess && (
|
||||
<CourseDetails populatedCourse={populatedCourse.data} />
|
||||
)}
|
||||
|
||||
{getNavigationsValue('link.journal.attendance') && (
|
||||
<Tooltip
|
||||
label="На страницу с лекциями"
|
||||
fontSize="12px"
|
||||
top="16px"
|
||||
>
|
||||
<Button
|
||||
leftIcon={<LinkIcon />}
|
||||
as={ConnectedLink}
|
||||
variant="outline"
|
||||
colorScheme="blue"
|
||||
to={generatePath(
|
||||
`${getNavigationsValue('journal.main')}${getNavigationsValue('link.journal.attendance')}`,
|
||||
{ courseId: course.id },
|
||||
)}
|
||||
>
|
||||
<Box mt={3}></Box>
|
||||
Посещаемость
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Stack>
|
||||
</CardBody>
|
||||
)}
|
||||
<CardFooter>
|
||||
<ButtonGroup
|
||||
spacing={[0, 4]}
|
||||
mt="16px"
|
||||
flexDirection={['column', 'row']}
|
||||
>
|
||||
<Tooltip label="На страницу с лекциями" fontSize="12px" top="16px">
|
||||
<Button
|
||||
leftIcon={<LinkIcon />}
|
||||
as={ConnectedLink}
|
||||
colorScheme="blue"
|
||||
to={`${getNavigationsValue('journal.main')}/lessons-list/${course._id}`}
|
||||
>
|
||||
Открыть
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip label="Детали" fontSize="12px" top="16px">
|
||||
<Button
|
||||
colorScheme="blue"
|
||||
mt={['16px', 0]}
|
||||
variant="outline"
|
||||
leftIcon={
|
||||
<ArrowUpIcon
|
||||
transform={isOpened ? 'rotate(0)' : 'rotate(180deg)'}
|
||||
/>
|
||||
}
|
||||
loadingText="Загрузка"
|
||||
isLoading={populatedCourse.isFetching}
|
||||
onClick={handleToggleOpene}
|
||||
>
|
||||
{isOpened ? 'Закрыть' : 'Просмотреть детали'}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</ButtonGroup>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
108
src/pages/course-list/course-details.tsx
Normal file
108
src/pages/course-list/course-details.tsx
Normal file
@@ -0,0 +1,108 @@
|
||||
import React from 'react'
|
||||
import dayjs from 'dayjs'
|
||||
import { Link as ConnectedLink } from 'react-router-dom'
|
||||
import { getNavigationsValue, getHistory } from '@brojs/cli'
|
||||
import { Stack, Heading, Link, Button, Tooltip, Box } from '@chakra-ui/react'
|
||||
|
||||
import { useAppSelector } from '../../__data__/store'
|
||||
import { isTeacher } from '../../utils/user'
|
||||
import { PopulatedCourse } from '../../__data__/model'
|
||||
import { api } from '../../__data__/api/api'
|
||||
import { LinkIcon } from '@chakra-ui/icons'
|
||||
|
||||
type CourseDetailsProps = {
|
||||
populatedCourse: PopulatedCourse
|
||||
}
|
||||
|
||||
const history = getHistory()
|
||||
|
||||
export const CourseDetails = ({ populatedCourse }: CourseDetailsProps) => {
|
||||
const user = useAppSelector((s) => s.user)
|
||||
const exam = populatedCourse.examWithJury
|
||||
const [toggleExamWithJury, examWithJuryRequest] =
|
||||
api.useToggleExamWithJuryMutation()
|
||||
|
||||
return (
|
||||
<>
|
||||
{isTeacher(user) && (
|
||||
<Heading as="h3" mt={4} mb={3} size="lg">
|
||||
Экзамен: {exam?.name}{' '}
|
||||
{exam && (
|
||||
<Tooltip label="Начать экзамен" fontSize="12px" top="16px">
|
||||
<Button
|
||||
leftIcon={<LinkIcon />}
|
||||
as={'a'}
|
||||
colorScheme="blue"
|
||||
href={
|
||||
getNavigationsValue('exam.main') +
|
||||
getNavigationsValue('link.exam.details')
|
||||
.replace(':courseId', populatedCourse.id)
|
||||
.replace(':examId', exam.id)
|
||||
}
|
||||
onClick={(event) => {
|
||||
event.preventDefault()
|
||||
history.push(
|
||||
getNavigationsValue('exam.main') +
|
||||
getNavigationsValue('link.exam.details')
|
||||
.replace(':courseId', populatedCourse.id)
|
||||
.replace(':examId', exam.id),
|
||||
)
|
||||
}}
|
||||
>
|
||||
Открыть
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Heading>
|
||||
)}
|
||||
{!Boolean(exam) && (
|
||||
<>
|
||||
<Heading as="h3" mt={4} mb={3} size="lg">
|
||||
Не задан
|
||||
</Heading>
|
||||
<Box mt={10}>
|
||||
<Tooltip label="Создать экзамен с жюри" fontSize="12px" top="16px">
|
||||
<Button
|
||||
colorScheme="blue"
|
||||
mt={['16px', 0]}
|
||||
variant="outline"
|
||||
isLoading={examWithJuryRequest.isLoading}
|
||||
onClick={() => toggleExamWithJury(populatedCourse.id)}
|
||||
>
|
||||
Создать
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
{Boolean(exam) && (
|
||||
<>
|
||||
<Heading as="h3" mt={4} mb={3} size="lg">
|
||||
Количество членов жюри:
|
||||
</Heading>
|
||||
<Heading as="h3" mt={4} mb={3} size="lg">
|
||||
{populatedCourse.examWithJury.jury.length}
|
||||
</Heading>
|
||||
</>
|
||||
)}
|
||||
<Heading as="h3" mt={4} mb={3} size="lg">
|
||||
Список занятий:
|
||||
</Heading>
|
||||
<Stack>
|
||||
{populatedCourse?.lessons?.map((lesson) => (
|
||||
<Link
|
||||
as={ConnectedLink}
|
||||
key={lesson.id}
|
||||
to={
|
||||
isTeacher(user)
|
||||
? `${getNavigationsValue('journal.main')}/lesson/${populatedCourse.id}/${lesson.id}`
|
||||
: ''
|
||||
}
|
||||
>
|
||||
{lesson.name}
|
||||
</Link>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,56 +1,44 @@
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import dayjs from 'dayjs'
|
||||
import { Link as ConnectedLink } from 'react-router-dom'
|
||||
import { getNavigationsValue } from '@brojs/cli'
|
||||
import {
|
||||
Box,
|
||||
CardHeader,
|
||||
CardBody,
|
||||
CardFooter,
|
||||
ButtonGroup,
|
||||
Stack,
|
||||
StackDivider,
|
||||
Button,
|
||||
Card,
|
||||
Heading,
|
||||
Tooltip,
|
||||
Spinner,
|
||||
Container,
|
||||
VStack,
|
||||
Link,
|
||||
Input,
|
||||
CloseButton,
|
||||
FormControl,
|
||||
FormLabel,
|
||||
FormHelperText,
|
||||
Center,
|
||||
FormErrorMessage,
|
||||
useToast,
|
||||
} from '@chakra-ui/react'
|
||||
import { useForm, Controller } from 'react-hook-form'
|
||||
|
||||
import { ErrorSpan } from './style'
|
||||
import { ErrorSpan } from '../style'
|
||||
|
||||
import { useAppSelector } from '../__data__/store'
|
||||
import { api } from '../__data__/api/api'
|
||||
import { isTeacher } from '../utils/user'
|
||||
import { AddIcon, ArrowDownIcon, ArrowUpIcon, LinkIcon } from '@chakra-ui/icons'
|
||||
import { Course } from '../__data__/model'
|
||||
import { useAppSelector } from '../../__data__/store'
|
||||
import { api } from '../../__data__/api/api'
|
||||
import { isTeacher } from '../../utils/user'
|
||||
import { AddIcon } from '@chakra-ui/icons'
|
||||
import { PageLoader } from '../../components/page-loader/page-loader'
|
||||
import { CourseCard } from './course-card'
|
||||
|
||||
interface NewCourseForm {
|
||||
startDt: string
|
||||
name: string
|
||||
}
|
||||
|
||||
const CoursesList = () => {
|
||||
export const CoursesList = () => {
|
||||
const toast = useToast()
|
||||
const user = useAppSelector((s) => s.user)
|
||||
const { data, isLoading } = api.useCoursesListQuery()
|
||||
const [createUpdateCourse, crucQuery] = api.useCreateUpdateCourseMutation()
|
||||
const [showForm, setShowForm] = useState(false)
|
||||
const [courseDetailsOpenedId, setCourseDetailsOpenedId] = useState<
|
||||
string | null
|
||||
>(null)
|
||||
const toastRef = useRef(null)
|
||||
|
||||
const {
|
||||
@@ -93,17 +81,7 @@ const CoursesList = () => {
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<Container maxW="container.xl">
|
||||
<Center h="300px">
|
||||
<Spinner
|
||||
thickness="4px"
|
||||
speed="0.65s"
|
||||
emptyColor="gray.200"
|
||||
color="blue.500"
|
||||
size="xl"
|
||||
/>
|
||||
</Center>
|
||||
</Container>
|
||||
<PageLoader />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -212,110 +190,11 @@ const CoursesList = () => {
|
||||
<VStack as="ul" align="stretch">
|
||||
{data?.body?.map((c) => (
|
||||
<CourseCard
|
||||
isOpened={courseDetailsOpenedId === c._id}
|
||||
key={c._id}
|
||||
key={c.id}
|
||||
course={c}
|
||||
openDetails={() =>
|
||||
courseDetailsOpenedId === c._id
|
||||
? setCourseDetailsOpenedId(null)
|
||||
: setCourseDetailsOpenedId(c._id)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</VStack>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
const CourseCard = ({
|
||||
course,
|
||||
isOpened,
|
||||
openDetails,
|
||||
}: {
|
||||
course: Course
|
||||
isOpened: boolean
|
||||
openDetails: () => void
|
||||
}) => {
|
||||
const [getLessonList, lessonList] = api.useLazyLessonListQuery()
|
||||
useEffect(() => {
|
||||
if (isOpened) {
|
||||
getLessonList(course._id, true)
|
||||
}
|
||||
}, [isOpened])
|
||||
const user = useAppSelector((s) => s.user)
|
||||
|
||||
return (
|
||||
<Card key={course._id} align="left">
|
||||
<CardHeader>
|
||||
<Heading as="h2" mt="0">
|
||||
{course.name}
|
||||
</Heading>
|
||||
</CardHeader>
|
||||
{isOpened && (
|
||||
<CardBody mt="16px">
|
||||
<Stack divider={<StackDivider />} spacing="8px">
|
||||
<Box as="span" textAlign="left">
|
||||
{`Дата начала курса - ${dayjs(course.startDt).format('DD MMMM YYYYг.')}`}
|
||||
</Box>
|
||||
<Box as="span" textAlign="left">
|
||||
Количество занятий - {course.lessons.length}
|
||||
</Box>
|
||||
{lessonList.isFetching ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<>
|
||||
<Heading as="h3" mt={4} mb={3} size="lg">
|
||||
Список занятий:
|
||||
</Heading>
|
||||
<Stack>
|
||||
{lessonList.data?.body?.map((lesson) => (
|
||||
<Link
|
||||
as={ConnectedLink}
|
||||
key={lesson._id}
|
||||
to={
|
||||
isTeacher(user)
|
||||
? `${getNavigationsValue('journal.main')}/lesson/${course._id}/${lesson._id}`
|
||||
: ''
|
||||
}
|
||||
>
|
||||
{lesson.name}
|
||||
</Link>
|
||||
))}
|
||||
</Stack>
|
||||
</>
|
||||
)}
|
||||
</Stack>
|
||||
</CardBody>
|
||||
)}
|
||||
<CardFooter>
|
||||
<ButtonGroup spacing={[0, 4]} mt="16px" flexDirection={['column', 'row']}>
|
||||
<Tooltip label="На страницу с лекциями" fontSize="12px" top="16px">
|
||||
<Button
|
||||
leftIcon={<LinkIcon />}
|
||||
as={ConnectedLink}
|
||||
colorScheme="blue"
|
||||
to={`${getNavigationsValue('journal.main')}/lessons-list/${course._id}`}
|
||||
>
|
||||
Открыть
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip label="Детали" fontSize="12px" top="16px">
|
||||
<Button
|
||||
colorScheme="blue"
|
||||
mt={["16px", 0]}
|
||||
variant="outline"
|
||||
leftIcon={isOpened ? <ArrowUpIcon /> : <ArrowDownIcon />}
|
||||
loadingText="Загрузка"
|
||||
isLoading={lessonList.isFetching}
|
||||
onClick={openDetails}
|
||||
>
|
||||
Просмотреть детали
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</ButtonGroup>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
export default CoursesList
|
||||
3
src/pages/course-list/index.ts
Normal file
3
src/pages/course-list/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { CoursesList } from './course-list'
|
||||
|
||||
export default CoursesList
|
||||
@@ -4,3 +4,4 @@ export const CourseListPage = lazy(() => import(/* webpackChunkName: "course-lis
|
||||
export const LessonDetailsPage = lazy(() => import(/* webpackChunkName: "lesson-details" */ './lesson-details'));
|
||||
export const LessonListPage = lazy(() => import(/* webpackChunkName: "lesson-list" */ './lesson-list'));
|
||||
export const UserPage = lazy(() => import(/* webpackChunkName: "user-page" */ './user-page'));
|
||||
export const AttendancePage = lazy(() => import(/* webpackChunkName: "attendance-page" */ './attendance'));
|
||||
|
||||
144
src/pages/lesson-list/components/item.tsx
Normal file
144
src/pages/lesson-list/components/item.tsx
Normal file
@@ -0,0 +1,144 @@
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
import dayjs from 'dayjs'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { getNavigationsValue, getFeatures } from '@brojs/cli'
|
||||
import {
|
||||
Button,
|
||||
Tr,
|
||||
Td,
|
||||
Menu,
|
||||
MenuButton,
|
||||
MenuItem,
|
||||
MenuList,
|
||||
useToast,
|
||||
} from '@chakra-ui/react'
|
||||
import { EditIcon } from '@chakra-ui/icons'
|
||||
|
||||
import { qrCode } from '../../../assets'
|
||||
|
||||
import { LessonForm } from './lessons-form'
|
||||
import { api } from '../../../__data__/api/api'
|
||||
|
||||
const features = getFeatures('journal')
|
||||
const groupByDate = features?.['group.by.date']
|
||||
|
||||
type ItemProps = {
|
||||
id: string
|
||||
date: string
|
||||
name: string
|
||||
isTeacher: boolean
|
||||
courseId: string
|
||||
setlessonToDelete(): void
|
||||
students: unknown[]
|
||||
}
|
||||
|
||||
export const Item: React.FC<ItemProps> = ({
|
||||
id,
|
||||
date,
|
||||
name,
|
||||
isTeacher,
|
||||
courseId,
|
||||
setlessonToDelete,
|
||||
students,
|
||||
}) => {
|
||||
const [edit, setEdit] = useState(false)
|
||||
const toastRef = useRef(null)
|
||||
const toast = useToast()
|
||||
const [updateLesson, updateLessonRqst] = api.useUpdateLessonMutation()
|
||||
const createdLessonRef = useRef(null)
|
||||
|
||||
const onSubmit = (lessonData) => {
|
||||
toastRef.current = toast({
|
||||
title: 'Отправляем',
|
||||
status: 'loading',
|
||||
duration: 9000,
|
||||
})
|
||||
createdLessonRef.current = lessonData
|
||||
if (navigator.onLine) {
|
||||
updateLesson(lessonData)
|
||||
} else {
|
||||
toast.update(toastRef.current, {
|
||||
title: 'Отсутствует интернет',
|
||||
status: 'error',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (updateLessonRqst.isSuccess) {
|
||||
const toastProps = {
|
||||
title: 'Лекция Обновлена',
|
||||
description: `Лекция ${createdLessonRef.current?.name} успешно обновлена`,
|
||||
status: 'success' as const,
|
||||
duration: 9000,
|
||||
isClosable: true,
|
||||
}
|
||||
if (toastRef.current) toast.update(toastRef.current, toastProps)
|
||||
else toast(toastProps)
|
||||
setEdit(false)
|
||||
}
|
||||
}, [updateLessonRqst.isSuccess])
|
||||
|
||||
if (edit && isTeacher) {
|
||||
return (
|
||||
<Tr>
|
||||
<Td colSpan={5}>
|
||||
<LessonForm
|
||||
isLoading={updateLessonRqst.isLoading}
|
||||
error={(updateLessonRqst.error as any)?.error}
|
||||
onSubmit={onSubmit}
|
||||
onCancel={() => {
|
||||
setEdit(false)
|
||||
}}
|
||||
lesson={{ _id: id, id, name, date }}
|
||||
title={'Редактирование лекции'}
|
||||
nameButton={'Сохранить'}
|
||||
/>
|
||||
</Td>
|
||||
</Tr>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Tr>
|
||||
{isTeacher && (
|
||||
<Td>
|
||||
<Link
|
||||
to={`${getNavigationsValue('journal.main')}/lesson/${courseId}/${id}`}
|
||||
style={{ display: 'flex' }}
|
||||
>
|
||||
<img width={24} src={qrCode} style={{ margin: '0 auto' }} />
|
||||
</Link>
|
||||
</Td>
|
||||
)}
|
||||
<Td textAlign="center">
|
||||
{dayjs(date).format(groupByDate ? 'HH:mm' : 'HH:mm DD.MM.YY')}
|
||||
</Td>
|
||||
<Td>{name}</Td>
|
||||
{isTeacher && (
|
||||
<Td>
|
||||
{!edit && (
|
||||
<Menu>
|
||||
<MenuButton as={Button}>
|
||||
<EditIcon />
|
||||
</MenuButton>
|
||||
<MenuList>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setEdit(true)
|
||||
}}
|
||||
>
|
||||
Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={setlessonToDelete}>Delete</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
)}
|
||||
{edit && <Button onClick={setlessonToDelete}>Сохранить</Button>}
|
||||
</Td>
|
||||
)}
|
||||
<Td isNumeric>{students.length}</Td>
|
||||
</Tr>
|
||||
)
|
||||
}
|
||||
45
src/pages/lesson-list/components/lesson-items.tsx
Normal file
45
src/pages/lesson-list/components/lesson-items.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import React from 'react'
|
||||
import dayjs from 'dayjs'
|
||||
import {
|
||||
Tr,
|
||||
Td,
|
||||
} from '@chakra-ui/react'
|
||||
|
||||
import { Lesson } from '../../../__data__/model'
|
||||
|
||||
import { Item } from './item'
|
||||
|
||||
type LessonItemProps = {
|
||||
date: string
|
||||
lessons: Lesson[]
|
||||
isTeacher: boolean
|
||||
courseId: string
|
||||
setlessonToDelete(lesson: Lesson): void
|
||||
}
|
||||
|
||||
export const LessonItems: React.FC<LessonItemProps> = ({
|
||||
date,
|
||||
lessons,
|
||||
isTeacher,
|
||||
courseId,
|
||||
setlessonToDelete,
|
||||
}) => (
|
||||
<>
|
||||
{date && (
|
||||
<Tr>
|
||||
<Td colSpan={isTeacher ? 5 : 3}>
|
||||
{dayjs(date).format('DD MMMM YYYY')}
|
||||
</Td>
|
||||
</Tr>
|
||||
)}
|
||||
{lessons.map((lesson) => (
|
||||
<Item
|
||||
key={lesson.id}
|
||||
{...lesson}
|
||||
setlessonToDelete={() => setlessonToDelete(lesson)}
|
||||
courseId={courseId}
|
||||
isTeacher={isTeacher}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
)
|
||||
@@ -22,8 +22,8 @@ import { Lesson } from '../../../__data__/model'
|
||||
import { ErrorSpan } from '../style'
|
||||
|
||||
interface NewLessonForm {
|
||||
name: string;
|
||||
date: string;
|
||||
name: string
|
||||
date: string
|
||||
}
|
||||
|
||||
interface LessonFormProps {
|
||||
@@ -51,7 +51,10 @@ export const LessonForm = ({
|
||||
reset,
|
||||
formState: { errors },
|
||||
} = useForm<NewLessonForm>({
|
||||
defaultValues: (lesson && { ...lesson, date: dateToCalendarFormat(lesson.date) }) || {
|
||||
defaultValues: (lesson && {
|
||||
...lesson,
|
||||
date: dateToCalendarFormat(lesson.date),
|
||||
}) || {
|
||||
name: '',
|
||||
date: dateToCalendarFormat(),
|
||||
},
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import React, {
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react'
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import dayjs from 'dayjs'
|
||||
import { Link, useParams } from 'react-router-dom'
|
||||
import { generatePath, Link, useParams } from 'react-router-dom'
|
||||
import { getNavigationsValue, getFeatures } from '@brojs/cli'
|
||||
import {
|
||||
Breadcrumb,
|
||||
@@ -22,12 +17,7 @@ import {
|
||||
Tr,
|
||||
Th,
|
||||
Tbody,
|
||||
Td,
|
||||
Menu,
|
||||
MenuButton,
|
||||
MenuItem,
|
||||
Text,
|
||||
MenuList,
|
||||
AlertDialog,
|
||||
AlertDialogBody,
|
||||
AlertDialogContent,
|
||||
@@ -35,18 +25,18 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogOverlay,
|
||||
} from '@chakra-ui/react'
|
||||
import { AddIcon, EditIcon } from '@chakra-ui/icons'
|
||||
import { AddIcon } from '@chakra-ui/icons'
|
||||
|
||||
import { useAppSelector } from '../../__data__/store'
|
||||
import { api } from '../../__data__/api/api'
|
||||
import { isTeacher } from '../../utils/user'
|
||||
import { qrCode } from '../../assets'
|
||||
import { Lesson } from '../../__data__/model'
|
||||
import { XlSpinner } from '../../components/xl-spinner'
|
||||
|
||||
import { LessonForm } from './components/lessons-form'
|
||||
import { BreadcrumbsWrapper } from './style'
|
||||
import { Bar } from './components/bar'
|
||||
import { LessonItems } from './components/lesson-items'
|
||||
import { BreadcrumbsWrapper } from './style'
|
||||
|
||||
const features = getFeatures('journal')
|
||||
|
||||
@@ -67,7 +57,10 @@ const LessonList = () => {
|
||||
const toastRef = useRef(null)
|
||||
const createdLessonRef = useRef(null)
|
||||
const [editLesson, setEditLesson] = useState<Lesson>(null)
|
||||
const sorted = useMemo(() => [...(data?.body || [])]?.sort((a, b) => a.date > b.date ? 1 : -1), [data, data?.body])
|
||||
const sorted = useMemo(
|
||||
() => [...(data?.body || [])]?.sort((a, b) => (a.date > b.date ? 1 : -1)),
|
||||
[data, data?.body],
|
||||
)
|
||||
|
||||
const lessonCalc = useMemo(() => {
|
||||
if (!isSuccess) {
|
||||
@@ -95,7 +88,7 @@ const LessonList = () => {
|
||||
}
|
||||
}
|
||||
|
||||
return lessonsData.sort((a, b) => a.date < b.date? 1 : -1)
|
||||
return lessonsData.sort((a, b) => (a.date < b.date ? 1 : -1))
|
||||
}, [groupByDate, isSuccess, sorted])
|
||||
|
||||
const onSubmit = (lessonData) => {
|
||||
@@ -153,8 +146,8 @@ const LessonList = () => {
|
||||
if (crLQuery.isSuccess) {
|
||||
const toastProps = {
|
||||
title: 'Лекция создана',
|
||||
description: `Лекция ${createdLessonRef.current.name} успешно создана`,
|
||||
status: 'success' as 'success',
|
||||
description: `Лекция ${createdLessonRef.current?.name} успешно создана`,
|
||||
status: 'success' as const,
|
||||
duration: 9000,
|
||||
isClosable: true,
|
||||
}
|
||||
@@ -168,8 +161,8 @@ const LessonList = () => {
|
||||
if (updateLessonRqst.isSuccess) {
|
||||
const toastProps = {
|
||||
title: 'Лекция Обновлена',
|
||||
description: `Лекция ${createdLessonRef.current.name} успешно обновлена`,
|
||||
status: 'success' as 'success',
|
||||
description: `Лекция ${createdLessonRef.current?.name} успешно обновлена`,
|
||||
status: 'success' as const,
|
||||
duration: 9000,
|
||||
isClosable: true,
|
||||
}
|
||||
@@ -180,7 +173,7 @@ const LessonList = () => {
|
||||
}, [updateLessonRqst.isSuccess])
|
||||
|
||||
if (isLoading) {
|
||||
return <XlSpinner />;
|
||||
return <XlSpinner />
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -213,7 +206,7 @@ const LessonList = () => {
|
||||
colorScheme="red"
|
||||
loadingText=""
|
||||
isLoading={deletingRqst.isLoading}
|
||||
onClick={() => deleteLesson(lessonToDelete._id)}
|
||||
onClick={() => deleteLesson(lessonToDelete.id)}
|
||||
ml={3}
|
||||
>
|
||||
Delete
|
||||
@@ -240,7 +233,7 @@ const LessonList = () => {
|
||||
<Box mt="15" mb="15">
|
||||
{showForm ? (
|
||||
<LessonForm
|
||||
key={editLesson?._id}
|
||||
key={editLesson?.id}
|
||||
isLoading={crLQuery.isLoading}
|
||||
onSubmit={onSubmit}
|
||||
onCancel={() => {
|
||||
@@ -253,7 +246,6 @@ const LessonList = () => {
|
||||
nameButton={editLesson ? 'Редактировать' : 'Создать'}
|
||||
/>
|
||||
) : (
|
||||
<Box p="2" m="2">
|
||||
<Button
|
||||
leftIcon={<AddIcon />}
|
||||
colorScheme="green"
|
||||
@@ -261,11 +253,10 @@ const LessonList = () => {
|
||||
>
|
||||
Добавить
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
{barFeature && sorted?.length && (
|
||||
{barFeature && sorted?.length > 1 && (
|
||||
<Box height="300">
|
||||
<Bar
|
||||
data={sorted.map((lesson, index) => ({
|
||||
@@ -285,65 +276,23 @@ const LessonList = () => {
|
||||
</Th>
|
||||
)}
|
||||
<Th textAlign="center" width={1}>
|
||||
Дата
|
||||
{groupByDate ? 'Время' : 'Дата'}
|
||||
</Th>
|
||||
<Th>Название</Th>
|
||||
<Th width="100%">Название</Th>
|
||||
{isTeacher(user) && <Th>action</Th>}
|
||||
<Th isNumeric>Отмечено</Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{lessonCalc?.map(({ data: lessons, date }) => (
|
||||
<React.Fragment key={date}>
|
||||
{date && <Tr><Td colSpan={isTeacher(user) ? 5 : 3}>{dayjs(date).format('DD MMMM YYYY')}</Td></Tr>}
|
||||
{lessons.map((lesson) => (
|
||||
<Tr key={lesson._id}>
|
||||
{isTeacher(user) && (
|
||||
<Td>
|
||||
<Link
|
||||
to={`${getNavigationsValue('journal.main')}/lesson/${courseId}/${lesson._id}`}
|
||||
style={{ display: 'flex' }}
|
||||
>
|
||||
<img
|
||||
width={24}
|
||||
src={qrCode}
|
||||
style={{ margin: '0 auto' }}
|
||||
<LessonItems
|
||||
courseId={courseId}
|
||||
date={date}
|
||||
isTeacher={isTeacher(user)}
|
||||
lessons={lessons}
|
||||
setlessonToDelete={setlessonToDelete}
|
||||
key={date}
|
||||
/>
|
||||
</Link>
|
||||
</Td>
|
||||
)}
|
||||
<Td textAlign="center">
|
||||
{dayjs(lesson.date).format(groupByDate ? 'HH:mm' : 'HH:mm DD.MM.YY')}
|
||||
</Td>
|
||||
<Td>{lesson.name}</Td>
|
||||
{isTeacher(user) && (
|
||||
<Td>
|
||||
<Menu>
|
||||
<MenuButton as={Button}>
|
||||
<EditIcon />
|
||||
</MenuButton>
|
||||
<MenuList>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setShowForm(true)
|
||||
setEditLesson(lesson)
|
||||
}}
|
||||
>
|
||||
Edit
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={() => setlessonToDelete(lesson)}
|
||||
>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
</Td>
|
||||
)}
|
||||
<Td isNumeric>{lesson.students.length}</Td>
|
||||
</Tr>
|
||||
))}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</Tbody>
|
||||
</Table>
|
||||
|
||||
@@ -3,16 +3,31 @@ const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
|
||||
const timer =
|
||||
(time = 1000) =>
|
||||
(time = 1000) =>
|
||||
(_req, _res, next) =>
|
||||
setTimeout(next, time)
|
||||
|
||||
router.use(timer())
|
||||
|
||||
const config = {
|
||||
examCreated: false
|
||||
}
|
||||
|
||||
router.get('/course/list', (req, res) => {
|
||||
res.send(require('../mocks/courses/list/success.json'))
|
||||
})
|
||||
|
||||
router.get('/course/:id', (req, res) => {
|
||||
if(req.params.id === 'undefined')
|
||||
return res.status(400).send({ success: false, error: 'Invalid course id' })
|
||||
|
||||
if (config.examCreated) {
|
||||
config.examCreated = false
|
||||
return res.send(require('../mocks/courses/by-id/with-exam.json'))
|
||||
}
|
||||
res.send(require('../mocks/courses/by-id/success.json'))
|
||||
})
|
||||
|
||||
router.get('/course/students/:courseId', (req, res) => {
|
||||
res.send(require('../mocks/courses/all-students/success.json'))
|
||||
})
|
||||
@@ -21,6 +36,11 @@ router.post('/course', (req, res) => {
|
||||
res.send(require('../mocks/courses/create/success.json'))
|
||||
})
|
||||
|
||||
router.post('/course/toggle-exam-with-jury/:id', (req, res) => {
|
||||
config.examCreated = true;
|
||||
res.send({ success: true })
|
||||
})
|
||||
|
||||
router.get('/lesson/list/:courseId', (req, res) => {
|
||||
res.send(require('../mocks/lessons/list/success.json'))
|
||||
})
|
||||
|
||||
671
stubs/mocks/courses/by-id/success.json
Normal file
671
stubs/mocks/courses/by-id/success.json
Normal file
@@ -0,0 +1,671 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": {
|
||||
"_id": "66cb6c8109bcc33fddd63ee3",
|
||||
"name": "Курс по JS",
|
||||
"teachers": [],
|
||||
"lessons": [
|
||||
{
|
||||
"_id": "65e2e5fbec37fec650f28489",
|
||||
"name": "ВВЕДЕНИЕ В ВЕБ-РАЗРАБОТКУ. ИНСТРУМЕНТАРИЙ, ОБЗОР ВЕБ-ТЕХНОЛОГИЙ",
|
||||
"students": [
|
||||
{
|
||||
"sub": "fcde3f22-d9ba-412a-a572-c59e515a290f",
|
||||
"email_verified": true,
|
||||
"name": "Мария Капитанова",
|
||||
"preferred_username": "maryaKapitan@gmail.com",
|
||||
"given_name": "Мария",
|
||||
"family_name": "Капитанова",
|
||||
"email": "maryaKapitan@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJgIjjOFD2YUSyRF5kH4jaysE6X5p-kq0Cg0CFncfMi=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "5b072deb-33ee-443e-9718-3b5720a3dfb7",
|
||||
"email_verified": true,
|
||||
"name": "Евгений Кореной",
|
||||
"preferred_username": "koren@gmail.com",
|
||||
"given_name": "Кореной",
|
||||
"family_name": "Евгений",
|
||||
"email": "koren@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJpVhDeG-Rpjjm2Un6r8ACz_s_injuIFKpzXf3qmyCn3Cg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "7adf0cd1-cf07-4079-88d8-1a5c9b8f42c2",
|
||||
"email_verified": true,
|
||||
"name": "Ирина Игнатьева",
|
||||
"preferred_username": "irign@gmailcom",
|
||||
"given_name": "Ирина",
|
||||
"family_name": "Игнатьева",
|
||||
"email": "irign@gmailcom",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocL45E4Gt8D5oyIl3ipkcGsv4ShWGs3bdlwEMA_1rzGZ=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "95ccc005-95b9-4305-9447-364a32033911",
|
||||
"email_verified": true,
|
||||
"name": "Иван Петров",
|
||||
"preferred_username": "petrov@mail.ru",
|
||||
"given_name": "Иван",
|
||||
"family_name": "Петров",
|
||||
"email": "petrov@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocIgQn5mfDAh2djx-3ofG9z1Em26ZyuUgVPd-6rDOl6z=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "ede1ef2c-6ecf-484a-8fb8-282a77e1caa1",
|
||||
"email_verified": true,
|
||||
"name": "Константин Тимуров",
|
||||
"preferred_username": "konstantK@gmail.com",
|
||||
"given_name": "Константин",
|
||||
"family_name": "Тимуров",
|
||||
"email": "konstantK@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJjnOfqaoAU_D4STrJPN9fPOeJ8tv60WbWVZu2ZWcHs=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "92cc6a15-805c-4439-b592-b23f32d6d208",
|
||||
"email_verified": true,
|
||||
"name": "Александра Питерская",
|
||||
"preferred_username": "piteralex@gmail.com",
|
||||
"given_name": "Александра",
|
||||
"family_name": "Питерская",
|
||||
"email": "piteralex@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKhbCbWvBBc_m7bjU5sLCE-dQ-KygBk-aUCSR8XaYtq=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "4a3ba8b8-4120-4877-a160-be9ba4d5b3e3",
|
||||
"email_verified": true,
|
||||
"name": "Анастасия Светлых",
|
||||
"preferred_username": "anastasya@gmail.ocm",
|
||||
"given_name": "Анастасия",
|
||||
"family_name": "Светлых",
|
||||
"email": "anastasya@gmail.ocm",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJnsM8UGhbH806yLVgWZ17g3-gJFVcG0Uz5kvqT7dvC=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "b4634921-00b3-4082-9284-8ac47f269394",
|
||||
"email_verified": true,
|
||||
"name": "Эмилия Снежко",
|
||||
"preferred_username": "emi@mail.ru",
|
||||
"given_name": "Эмилия",
|
||||
"family_name": "Снежко",
|
||||
"email": "emi@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocI98dzSFQDPr2LXMPFEUX8KLY6bY2m08O_aAj2B5KVNKg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "bf1a95aa-39a2-4528-9b8d-319409995df5",
|
||||
"email_verified": true,
|
||||
"name": "Юлия Бобова",
|
||||
"preferred_username": "bobova@gmail.com",
|
||||
"given_name": "Юлия",
|
||||
"family_name": "Бобова",
|
||||
"email": "bobova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJ_Ud4iI-jgqcJ3QJcWpESbRLX_C1BnB8_7uTTC-4Dn=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "c273a3e3-f7ba-4057-8c57-a1f43b6174a5",
|
||||
"email_verified": true,
|
||||
"name": "Анна Самоварова",
|
||||
"preferred_username": "samovar@gmail.com",
|
||||
"given_name": "Анна",
|
||||
"family_name": "Самоварова",
|
||||
"email": "samovar@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJOhIMdQkXPd55wTMgTTkUCnqbsu4EncgEPm67iz_mK=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "8555885b-715c-4dee-a7c5-9563a6a05211",
|
||||
"email_verified": true,
|
||||
"name": "Евгения Жужова",
|
||||
"preferred_username": "zhuzhova@gmail.com",
|
||||
"given_name": "Евгения",
|
||||
"family_name": "Жужова",
|
||||
"email": "zhuzhova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJUtJBAVBm642AxoGpMDDMV8CPu3MEoLjU3hmO7oisG=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "12dee54f-64e9-4be3-9cb0-02ff07ab24fe",
|
||||
"email_verified": true,
|
||||
"name": "Эдгар Петренко",
|
||||
"preferred_username": "petrenk@mail.ru",
|
||||
"given_name": "Эдгар",
|
||||
"family_name": "Петренко",
|
||||
"email": "petrenk@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocLgKAZag32kpGVHMVbh_GsU-rX_MAtmeVIPoov0ZPBYIA=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "4082b72a-4730-4841-ad68-06a0e19263df",
|
||||
"email_verified": true,
|
||||
"name": "Елена Вавилон",
|
||||
"preferred_username": "elenvavil@mail.ru",
|
||||
"given_name": "Елена",
|
||||
"family_name": "Вавилон",
|
||||
"email": "elenvavil@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKXcmzcqRch2--j2Ge2m9e8MIOZ8y1MjsQ0cSEoXOmW=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "9e8a08d8-d76a-4f26-99c5-9a1d3c067104",
|
||||
"email_verified": true,
|
||||
"name": "Ольга Шарова",
|
||||
"preferred_username": "julyashap",
|
||||
"given_name": "Ольга",
|
||||
"family_name": "Шарова",
|
||||
"email": "sharova@mail.ru"
|
||||
}
|
||||
],
|
||||
"date": "2024-03-02T08:40:27.390Z",
|
||||
"created": "2024-03-02T08:40:27.390Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "65e301c4ec37fec650f2aafe",
|
||||
"name": "НАСТРОЙКА ОКРУЖЕНИЯ (GIT + VSCODE + NODEJS)",
|
||||
"students": [
|
||||
{
|
||||
"sub": "5b072deb-33ee-443e-9718-3b5720a3dfb7",
|
||||
"email_verified": true,
|
||||
"name": "Евгений Кореной",
|
||||
"preferred_username": "koren@gmail.com",
|
||||
"given_name": "Кореной",
|
||||
"family_name": "Евгений",
|
||||
"email": "koren@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJpVhDeG-Rpjjm2Un6r8ACz_s_injuIFKpzXf3qmyCn3Cg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "7adf0cd1-cf07-4079-88d8-1a5c9b8f42c2",
|
||||
"email_verified": true,
|
||||
"name": "Ирина Игнатьева",
|
||||
"preferred_username": "irign@gmailcom",
|
||||
"given_name": "Ирина",
|
||||
"family_name": "Игнатьева",
|
||||
"email": "irign@gmailcom",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocL45E4Gt8D5oyIl3ipkcGsv4ShWGs3bdlwEMA_1rzGZ=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "ede1ef2c-6ecf-484a-8fb8-282a77e1caa1",
|
||||
"email_verified": true,
|
||||
"name": "Константин Тимуров",
|
||||
"preferred_username": "konstantK@gmail.com",
|
||||
"given_name": "Константин",
|
||||
"family_name": "Тимуров",
|
||||
"email": "konstantK@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJjnOfqaoAU_D4STrJPN9fPOeJ8tv60WbWVZu2ZWcHs=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "92cc6a15-805c-4439-b592-b23f32d6d208",
|
||||
"email_verified": true,
|
||||
"name": "Александра Питерская",
|
||||
"preferred_username": "piteralex@gmail.com",
|
||||
"given_name": "Александра",
|
||||
"family_name": "Питерская",
|
||||
"email": "piteralex@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKhbCbWvBBc_m7bjU5sLCE-dQ-KygBk-aUCSR8XaYtq=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "b4634921-00b3-4082-9284-8ac47f269394",
|
||||
"email_verified": true,
|
||||
"name": "Эмилия Снежко",
|
||||
"preferred_username": "emi@mail.ru",
|
||||
"given_name": "Эмилия",
|
||||
"family_name": "Снежко",
|
||||
"email": "emi@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocI98dzSFQDPr2LXMPFEUX8KLY6bY2m08O_aAj2B5KVNKg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "bf1a95aa-39a2-4528-9b8d-319409995df5",
|
||||
"email_verified": true,
|
||||
"name": "Юлия Бобова",
|
||||
"preferred_username": "bobova@gmail.com",
|
||||
"given_name": "Юлия",
|
||||
"family_name": "Бобова",
|
||||
"email": "bobova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJ_Ud4iI-jgqcJ3QJcWpESbRLX_C1BnB8_7uTTC-4Dn=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "c273a3e3-f7ba-4057-8c57-a1f43b6174a5",
|
||||
"email_verified": true,
|
||||
"name": "Анна Самоварова",
|
||||
"preferred_username": "samovar@gmail.com",
|
||||
"given_name": "Анна",
|
||||
"family_name": "Самоварова",
|
||||
"email": "samovar@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJOhIMdQkXPd55wTMgTTkUCnqbsu4EncgEPm67iz_mK=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "8555885b-715c-4dee-a7c5-9563a6a05211",
|
||||
"email_verified": true,
|
||||
"name": "Евгения Жужова",
|
||||
"preferred_username": "zhuzhova@gmail.com",
|
||||
"given_name": "Евгения",
|
||||
"family_name": "Жужова",
|
||||
"email": "zhuzhova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJUtJBAVBm642AxoGpMDDMV8CPu3MEoLjU3hmO7oisG=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "4082b72a-4730-4841-ad68-06a0e19263df",
|
||||
"email_verified": true,
|
||||
"name": "Елена Вавилон",
|
||||
"preferred_username": "elenvavil@mail.ru",
|
||||
"given_name": "Елена",
|
||||
"family_name": "Вавилон",
|
||||
"email": "elenvavil@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKXcmzcqRch2--j2Ge2m9e8MIOZ8y1MjsQ0cSEoXOmW=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "9e8a08d8-d76a-4f26-99c5-9a1d3c067104",
|
||||
"email_verified": true,
|
||||
"name": "Ольга Шарова",
|
||||
"preferred_username": "julyashap",
|
||||
"given_name": "Ольга",
|
||||
"family_name": "Шарова",
|
||||
"email": "sharova@mail.ru"
|
||||
}
|
||||
],
|
||||
"date": "2024-03-02T10:39:00.718Z",
|
||||
"created": "2024-03-02T10:39:00.718Z",
|
||||
"__v": 0
|
||||
},
|
||||
{
|
||||
"_id": "65e78bebced789d2f6791315",
|
||||
"name": "ПРОЕКТИРОВАНИЕ ИНТЕРФЕЙСОВ (MIND MAP. FIGMA)",
|
||||
"students": [
|
||||
{
|
||||
"sub": "fcde3f22-d9ba-412a-a572-c59e515a290f",
|
||||
"email_verified": true,
|
||||
"name": "Мария Капитанова",
|
||||
"preferred_username": "maryaKapitan@gmail.com",
|
||||
"given_name": "Мария",
|
||||
"family_name": "Капитанова",
|
||||
"email": "maryaKapitan@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJgIjjOFD2YUSyRF5kH4jaysE6X5p-kq0Cg0CFncfMi=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "5b072deb-33ee-443e-9718-3b5720a3dfb7",
|
||||
"email_verified": true,
|
||||
"name": "Евгений Кореной",
|
||||
"preferred_username": "koren@gmail.com",
|
||||
"given_name": "Кореной",
|
||||
"family_name": "Евгений",
|
||||
"email": "koren@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJpVhDeG-Rpjjm2Un6r8ACz_s_injuIFKpzXf3qmyCn3Cg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "95ccc005-95b9-4305-9447-364a32033911",
|
||||
"email_verified": true,
|
||||
"name": "Иван Петров",
|
||||
"preferred_username": "petrov@mail.ru",
|
||||
"given_name": "Иван",
|
||||
"family_name": "Петров",
|
||||
"email": "petrov@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocIgQn5mfDAh2djx-3ofG9z1Em26ZyuUgVPd-6rDOl6z=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "ede1ef2c-6ecf-484a-8fb8-282a77e1caa1",
|
||||
"email_verified": true,
|
||||
"name": "Константин Тимуров",
|
||||
"preferred_username": "konstantK@gmail.com",
|
||||
"given_name": "Константин",
|
||||
"family_name": "Тимуров",
|
||||
"email": "konstantK@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJjnOfqaoAU_D4STrJPN9fPOeJ8tv60WbWVZu2ZWcHs=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "92cc6a15-805c-4439-b592-b23f32d6d208",
|
||||
"email_verified": true,
|
||||
"name": "Александра Питерская",
|
||||
"preferred_username": "piteralex@gmail.com",
|
||||
"given_name": "Александра",
|
||||
"family_name": "Питерская",
|
||||
"email": "piteralex@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKhbCbWvBBc_m7bjU5sLCE-dQ-KygBk-aUCSR8XaYtq=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "b4634921-00b3-4082-9284-8ac47f269394",
|
||||
"email_verified": true,
|
||||
"name": "Эмилия Снежко",
|
||||
"preferred_username": "emi@mail.ru",
|
||||
"given_name": "Эмилия",
|
||||
"family_name": "Снежко",
|
||||
"email": "emi@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocI98dzSFQDPr2LXMPFEUX8KLY6bY2m08O_aAj2B5KVNKg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "bf1a95aa-39a2-4528-9b8d-319409995df5",
|
||||
"email_verified": true,
|
||||
"name": "Юлия Бобова",
|
||||
"preferred_username": "bobova@gmail.com",
|
||||
"given_name": "Юлия",
|
||||
"family_name": "Бобова",
|
||||
"email": "bobova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJ_Ud4iI-jgqcJ3QJcWpESbRLX_C1BnB8_7uTTC-4Dn=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "c273a3e3-f7ba-4057-8c57-a1f43b6174a5",
|
||||
"email_verified": true,
|
||||
"name": "Анна Самоварова",
|
||||
"preferred_username": "samovar@gmail.com",
|
||||
"given_name": "Анна",
|
||||
"family_name": "Самоварова",
|
||||
"email": "samovar@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJOhIMdQkXPd55wTMgTTkUCnqbsu4EncgEPm67iz_mK=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "8555885b-715c-4dee-a7c5-9563a6a05211",
|
||||
"email_verified": true,
|
||||
"name": "Евгения Жужова",
|
||||
"preferred_username": "zhuzhova@gmail.com",
|
||||
"given_name": "Евгения",
|
||||
"family_name": "Жужова",
|
||||
"email": "zhuzhova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJUtJBAVBm642AxoGpMDDMV8CPu3MEoLjU3hmO7oisG=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "12dee54f-64e9-4be3-9cb0-02ff07ab24fe",
|
||||
"email_verified": true,
|
||||
"name": "Эдгар Петренко",
|
||||
"preferred_username": "petrenk@mail.ru",
|
||||
"given_name": "Эдгар",
|
||||
"family_name": "Петренко",
|
||||
"email": "petrenk@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocLgKAZag32kpGVHMVbh_GsU-rX_MAtmeVIPoov0ZPBYIA=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "4082b72a-4730-4841-ad68-06a0e19263df",
|
||||
"email_verified": true,
|
||||
"name": "Елена Вавилон",
|
||||
"preferred_username": "elenvavil@mail.ru",
|
||||
"given_name": "Елена",
|
||||
"family_name": "Вавилон",
|
||||
"email": "elenvavil@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKXcmzcqRch2--j2Ge2m9e8MIOZ8y1MjsQ0cSEoXOmW=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "9e8a08d8-d76a-4f26-99c5-9a1d3c067104",
|
||||
"email_verified": true,
|
||||
"name": "Ольга Шарова",
|
||||
"preferred_username": "julyashap",
|
||||
"given_name": "Ольга",
|
||||
"family_name": "Шарова",
|
||||
"email": "sharova@mail.ru"
|
||||
}
|
||||
],
|
||||
"date": "2024-03-08T21:17:31.401Z",
|
||||
"created": "2024-03-05T21:17:31.401Z",
|
||||
"__v": 1
|
||||
},
|
||||
{
|
||||
"_id": "65e78c0fced789d2f679131b",
|
||||
"name": "ТЕХНОЛОГИЯ HTML СТРУКТУРА ДОКУМЕНТА И ОСНОВНЫЕ ПОНЯТИЯ.",
|
||||
"students": [
|
||||
{
|
||||
"sub": "fcde3f22-d9ba-412a-a572-c59e515a290f",
|
||||
"email_verified": true,
|
||||
"name": "Мария Капитанова",
|
||||
"preferred_username": "maryaKapitan@gmail.com",
|
||||
"given_name": "Мария",
|
||||
"family_name": "Капитанова",
|
||||
"email": "maryaKapitan@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJgIjjOFD2YUSyRF5kH4jaysE6X5p-kq0Cg0CFncfMi=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "b4634921-00b3-4082-9284-8ac47f269394",
|
||||
"email_verified": true,
|
||||
"name": "Эмилия Снежко",
|
||||
"preferred_username": "emi@mail.ru",
|
||||
"given_name": "Эмилия",
|
||||
"family_name": "Снежко",
|
||||
"email": "emi@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocI98dzSFQDPr2LXMPFEUX8KLY6bY2m08O_aAj2B5KVNKg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "bf1a95aa-39a2-4528-9b8d-319409995df5",
|
||||
"email_verified": true,
|
||||
"name": "Юлия Бобова",
|
||||
"preferred_username": "bobova@gmail.com",
|
||||
"given_name": "Юлия",
|
||||
"family_name": "Бобова",
|
||||
"email": "bobova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJ_Ud4iI-jgqcJ3QJcWpESbRLX_C1BnB8_7uTTC-4Dn=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "c273a3e3-f7ba-4057-8c57-a1f43b6174a5",
|
||||
"email_verified": true,
|
||||
"name": "Анна Самоварова",
|
||||
"preferred_username": "samovar@gmail.com",
|
||||
"given_name": "Анна",
|
||||
"family_name": "Самоварова",
|
||||
"email": "samovar@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJOhIMdQkXPd55wTMgTTkUCnqbsu4EncgEPm67iz_mK=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "8555885b-715c-4dee-a7c5-9563a6a05211",
|
||||
"email_verified": true,
|
||||
"name": "Евгения Жужова",
|
||||
"preferred_username": "zhuzhova@gmail.com",
|
||||
"given_name": "Евгения",
|
||||
"family_name": "Жужова",
|
||||
"email": "zhuzhova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJUtJBAVBm642AxoGpMDDMV8CPu3MEoLjU3hmO7oisG=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "12dee54f-64e9-4be3-9cb0-02ff07ab24fe",
|
||||
"email_verified": true,
|
||||
"name": "Эдгар Петренко",
|
||||
"preferred_username": "petrenk@mail.ru",
|
||||
"given_name": "Эдгар",
|
||||
"family_name": "Петренко",
|
||||
"email": "petrenk@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocLgKAZag32kpGVHMVbh_GsU-rX_MAtmeVIPoov0ZPBYIA=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "4082b72a-4730-4841-ad68-06a0e19263df",
|
||||
"email_verified": true,
|
||||
"name": "Елена Вавилон",
|
||||
"preferred_username": "elenvavil@mail.ru",
|
||||
"given_name": "Елена",
|
||||
"family_name": "Вавилон",
|
||||
"email": "elenvavil@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKXcmzcqRch2--j2Ge2m9e8MIOZ8y1MjsQ0cSEoXOmW=s96-c"
|
||||
}
|
||||
],
|
||||
"date": "2024-03-08T21:18:07.033Z",
|
||||
"created": "2024-03-05T21:18:07.033Z",
|
||||
"__v": 22
|
||||
},
|
||||
{
|
||||
"_id": "65e78c0fced789d2f6791tt5",
|
||||
"name": "ВВОДНАЯ ПО JS.ПРИМЕНЕНИЕ И СПОСОБЫ ПОДКЛЮЧЕНИЯ НА СТРАНИЦЕ. LET, CONST. БАЗОВЫЕ ТИПЫ ДАННЫХ, ПРИВЕДЕНИЕ ТИПОВ. ПЕРЕМЕННЫЕ, ОБЛАСТЬ ВИДИМОСТИ ПЕРЕМЕННЫХ",
|
||||
"students": [
|
||||
{
|
||||
"sub": "fcde3f22-d9ba-412a-a572-c59e515a290f",
|
||||
"email_verified": true,
|
||||
"name": "Мария Капитанова",
|
||||
"preferred_username": "maryaKapitan@gmail.com",
|
||||
"given_name": "Мария",
|
||||
"family_name": "Капитанова",
|
||||
"email": "maryaKapitan@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJgIjjOFD2YUSyRF5kH4jaysE6X5p-kq0Cg0CFncfMi=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "5b072deb-33ee-443e-9718-3b5720a3dfb7",
|
||||
"email_verified": true,
|
||||
"name": "Евгений Кореной",
|
||||
"preferred_username": "koren@gmail.com",
|
||||
"given_name": "Кореной",
|
||||
"family_name": "Евгений",
|
||||
"email": "koren@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJpVhDeG-Rpjjm2Un6r8ACz_s_injuIFKpzXf3qmyCn3Cg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "7adf0cd1-cf07-4079-88d8-1a5c9b8f42c2",
|
||||
"email_verified": true,
|
||||
"name": "Ирина Игнатьева",
|
||||
"preferred_username": "irign@gmailcom",
|
||||
"given_name": "Ирина",
|
||||
"family_name": "Игнатьева",
|
||||
"email": "irign@gmailcom",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocL45E4Gt8D5oyIl3ipkcGsv4ShWGs3bdlwEMA_1rzGZ=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "95ccc005-95b9-4305-9447-364a32033911",
|
||||
"email_verified": true,
|
||||
"name": "Иван Петров",
|
||||
"preferred_username": "petrov@mail.ru",
|
||||
"given_name": "Иван",
|
||||
"family_name": "Петров",
|
||||
"email": "petrov@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocIgQn5mfDAh2djx-3ofG9z1Em26ZyuUgVPd-6rDOl6z=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "ede1ef2c-6ecf-484a-8fb8-282a77e1caa1",
|
||||
"email_verified": true,
|
||||
"name": "Константин Тимуров",
|
||||
"preferred_username": "konstantK@gmail.com",
|
||||
"given_name": "Константин",
|
||||
"family_name": "Тимуров",
|
||||
"email": "konstantK@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJjnOfqaoAU_D4STrJPN9fPOeJ8tv60WbWVZu2ZWcHs=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "92cc6a15-805c-4439-b592-b23f32d6d208",
|
||||
"email_verified": true,
|
||||
"name": "Александра Питерская",
|
||||
"preferred_username": "piteralex@gmail.com",
|
||||
"given_name": "Александра",
|
||||
"family_name": "Питерская",
|
||||
"email": "piteralex@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKhbCbWvBBc_m7bjU5sLCE-dQ-KygBk-aUCSR8XaYtq=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "4a3ba8b8-4120-4877-a160-be9ba4d5b3e3",
|
||||
"email_verified": true,
|
||||
"name": "Анастасия Светлых",
|
||||
"preferred_username": "anastasya@gmail.ocm",
|
||||
"given_name": "Анастасия",
|
||||
"family_name": "Светлых",
|
||||
"email": "anastasya@gmail.ocm",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJnsM8UGhbH806yLVgWZ17g3-gJFVcG0Uz5kvqT7dvC=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "b4634921-00b3-4082-9284-8ac47f269394",
|
||||
"email_verified": true,
|
||||
"name": "Эмилия Снежко",
|
||||
"preferred_username": "emi@mail.ru",
|
||||
"given_name": "Эмилия",
|
||||
"family_name": "Снежко",
|
||||
"email": "emi@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocI98dzSFQDPr2LXMPFEUX8KLY6bY2m08O_aAj2B5KVNKg=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "bf1a95aa-39a2-4528-9b8d-319409995df5",
|
||||
"email_verified": true,
|
||||
"name": "Юлия Бобова",
|
||||
"preferred_username": "bobova@gmail.com",
|
||||
"given_name": "Юлия",
|
||||
"family_name": "Бобова",
|
||||
"email": "bobova@gmail.com",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocJ_Ud4iI-jgqcJ3QJcWpESbRLX_C1BnB8_7uTTC-4Dn=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "4082b72a-4730-4841-ad68-06a0e19263df",
|
||||
"email_verified": true,
|
||||
"name": "Елена Вавилон",
|
||||
"preferred_username": "elenvavil@mail.ru",
|
||||
"given_name": "Елена",
|
||||
"family_name": "Вавилон",
|
||||
"email": "elenvavil@mail.ru",
|
||||
"picture": "https://lh3.googleusercontent.com/a/ACg8ocKXcmzcqRch2--j2Ge2m9e8MIOZ8y1MjsQ0cSEoXOmW=s96-c"
|
||||
},
|
||||
{
|
||||
"sub": "9e8a08d8-d76a-4f26-99c5-9a1d3c067104",
|
||||
"email_verified": true,
|
||||
"name": "Ольга Шарова",
|
||||
"preferred_username": "julyashap",
|
||||
"given_name": "Ольга",
|
||||
"family_name": "Шарова",
|
||||
"email": "sharova@mail.ru"
|
||||
}
|
||||
],
|
||||
"date": "2024-03-08T21:18:07.033Z",
|
||||
"created": "2024-03-05T21:18:07.033Z"
|
||||
}
|
||||
],
|
||||
"creator": {
|
||||
"sub": "developer",
|
||||
"email": "email@email.ml"
|
||||
},
|
||||
"startDt": "2024-08-25T17:40:17.814Z",
|
||||
"created": "2024-08-25T17:40:17.814Z",
|
||||
"examWithJury2": {
|
||||
"_id": "66cf3d3f4637d420d6271451",
|
||||
"name": "Хакатон",
|
||||
"description": "Сегодня командам предстоит Защитить свои проекты а жюри оценить по критериям",
|
||||
"jury": [],
|
||||
"date": "2024-08-28T15:07:43.927Z",
|
||||
"created": "2024-08-28T15:07:43.927Z",
|
||||
"criterias": [
|
||||
[
|
||||
{
|
||||
"title": "Соответствие решения поставленной задаче",
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"wight": 1
|
||||
},
|
||||
{
|
||||
"title": "Оригинальность - использование нестандартных технических и проектных подходов к решению задачи",
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"wight": 1
|
||||
},
|
||||
{
|
||||
"title": "Характеристики решения",
|
||||
"subcriterias": [
|
||||
{
|
||||
"title": "Работоспособность решения",
|
||||
"type": "boolean",
|
||||
"wight": 1,
|
||||
"trueText": "Работоспособно",
|
||||
"falseText": "Не работоспособно"
|
||||
},
|
||||
{
|
||||
"title": "Технологическая сложность решения",
|
||||
"type": "number",
|
||||
"wight": 1,
|
||||
"min": 0,
|
||||
"max": 2
|
||||
},
|
||||
{
|
||||
"title": "Объем функциональных возможностей решения (количество и качество реализации функций)",
|
||||
"type": "number",
|
||||
"wight": 1,
|
||||
"min": 0,
|
||||
"max": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Аргументация способа выбранного решения",
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"wight": 1
|
||||
},
|
||||
{
|
||||
"title": "Качество предоставления информации",
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"wight": 1
|
||||
},
|
||||
{
|
||||
"title": "Наличие удобного UX/UI",
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"wight": 1
|
||||
}
|
||||
]
|
||||
],
|
||||
"id": "66cf3d3f4637d420d6271451"
|
||||
},
|
||||
"id": "66cb6c8109bcc33fddd63ee3"
|
||||
}
|
||||
}
|
||||
94
stubs/mocks/courses/by-id/with-exam.json
Normal file
94
stubs/mocks/courses/by-id/with-exam.json
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"success": true,
|
||||
"body": {
|
||||
"_id": "660b19fc865d7a5d914636c0",
|
||||
"name": "Курс по JS",
|
||||
"teachers": [],
|
||||
"lessons": [
|
||||
{
|
||||
"_id": "661e7f4f69f40b0ebebcd5e4",
|
||||
"name": "555",
|
||||
"students": [
|
||||
{
|
||||
"sub": "f62905b1-e223-40ca-910f-c8d84c6137c1",
|
||||
"email_verified": true,
|
||||
"name": "Александр Примаков",
|
||||
"preferred_username": "primakov",
|
||||
"given_name": "Александр",
|
||||
"family_name": "Примаков",
|
||||
"email": "primakovpro@gmail.com"
|
||||
}
|
||||
],
|
||||
"date": "2024-04-16T13:38:00.000Z",
|
||||
"created": "2024-04-16T13:38:23.381Z",
|
||||
"id": "661e7f4f69f40b0ebebcd5e4"
|
||||
},
|
||||
{
|
||||
"_id": "66af1e60a0eef5a89f99aa94",
|
||||
"name": "111",
|
||||
"students": [
|
||||
{
|
||||
"sub": "f62905b1-e223-40ca-910f-c8d84c6137c1",
|
||||
"email_verified": true,
|
||||
"name": "Александр Примаков",
|
||||
"preferred_username": "primakov",
|
||||
"given_name": "Александр",
|
||||
"family_name": "Примаков",
|
||||
"email": "primakovpro@gmail.com"
|
||||
}
|
||||
],
|
||||
"date": "2024-08-04T07:00:00.000Z",
|
||||
"created": "2024-08-04T06:23:28.491Z",
|
||||
"id": "66af1e60a0eef5a89f99aa94"
|
||||
},
|
||||
{
|
||||
"_id": "66ba1a01a0eef5a89f99ab27",
|
||||
"name": "11111",
|
||||
"students": [
|
||||
{
|
||||
"sub": "f62905b1-e223-40ca-910f-c8d84c6137c1",
|
||||
"email_verified": true,
|
||||
"name": "Александр Примаков",
|
||||
"preferred_username": "primakov",
|
||||
"given_name": "Александр",
|
||||
"family_name": "Примаков",
|
||||
"email": "primakovpro@gmail.com"
|
||||
}
|
||||
],
|
||||
"date": "2024-08-18T10:00:00.000Z",
|
||||
"created": "2024-08-12T14:19:46.004Z",
|
||||
"id": "66ba1a01a0eef5a89f99ab27"
|
||||
},
|
||||
{
|
||||
"_id": "66ba1a0da0eef5a89f99ab2d",
|
||||
"name": "2222",
|
||||
"students": [],
|
||||
"date": "2024-08-18T14:19:00.000Z",
|
||||
"created": "2024-08-12T14:19:57.798Z",
|
||||
"id": "66ba1a0da0eef5a89f99ab2d"
|
||||
}
|
||||
],
|
||||
"startDt": "2024-06-01T00:00:00.000Z",
|
||||
"creator": {
|
||||
"sub": "f62905b1-e223-40ca-910f-c8d84c6137c1",
|
||||
"email_verified": true,
|
||||
"name": "Александр Примаков",
|
||||
"preferred_username": "primakov",
|
||||
"given_name": "Александр",
|
||||
"family_name": "Примаков",
|
||||
"email": "primakovpro@gmail.com"
|
||||
},
|
||||
"created": "2024-04-01T20:33:00.912Z",
|
||||
"examWithJury": {
|
||||
"_id": "66d01766ce794e1fdb2bf097",
|
||||
"name": "Хакатон",
|
||||
"description": "Сегодня командам предстоит Защитить свои проекты а жюри оценить по критериям",
|
||||
"jury": [],
|
||||
"criterias": [],
|
||||
"date": "2024-08-29T06:38:30.678Z",
|
||||
"created": "2024-08-29T06:38:30.678Z",
|
||||
"id": "66d01766ce794e1fdb2bf097"
|
||||
},
|
||||
"id": "660b19fc865d7a5d914636c0"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"success": true,
|
||||
"body": [
|
||||
{
|
||||
"_id": "65e73c21ced789d2f679128f",
|
||||
"id": "65e73c21ced789d2f679128f",
|
||||
"name": "KFU-24-1",
|
||||
"teachers": [],
|
||||
"lessons": [
|
||||
@@ -21,11 +21,11 @@
|
||||
"email": "primakovpro@gmail.com"
|
||||
},
|
||||
"startDt": "2024-03-02T15:37:05.907Z",
|
||||
"created": "2024-03-02T15:37:05.908Z",
|
||||
"__v": 2
|
||||
"examWithJury": "66cf3d3f4637d420d6271451",
|
||||
"created": "2024-03-02T15:37:05.908Z"
|
||||
},
|
||||
{
|
||||
"_id": "65e73c21ced789d2f679128z",
|
||||
"id": "65e73c21ced789d2f679128z",
|
||||
"name": "KFU-24-2",
|
||||
"teachers": [],
|
||||
"lessons": [
|
||||
|
||||
Reference in New Issue
Block a user