Добавил в админку создание фиктивных лекций
Frontend CI / build-and-check (push) Failing after 5m15s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 15s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 18s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 31s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 11s
Frontend CI / build-and-check (push) Failing after 5m15s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 15s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 18s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 31s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 11s
This commit is contained in:
+36
-12
@@ -4,6 +4,7 @@ import type {
|
||||
AuthResponse,
|
||||
CoinTransactionDto,
|
||||
CourseDto,
|
||||
CreateLectureRequest,
|
||||
LectureDto,
|
||||
LectureQuery,
|
||||
LocationDto,
|
||||
@@ -39,10 +40,18 @@ export const lecturesApi = {
|
||||
return extractItems(payload)
|
||||
},
|
||||
get: (id: string | number) => apiRequest<LectureDto>(`/lectures/${id}`),
|
||||
create: (payload: CreateLectureRequest) =>
|
||||
apiRequest<LectureDto>('/lectures', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
}),
|
||||
enroll: (id: string | number) => apiRequest<void>(`/lectures/${id}/enroll`, { method: 'POST' }),
|
||||
unenroll: (id: string | number) => apiRequest<void>(`/lectures/${id}/enroll`, { method: 'DELETE' }),
|
||||
unenroll: (id: string | number) =>
|
||||
apiRequest<void>(`/lectures/${id}/enroll`, { method: 'DELETE' }),
|
||||
async reviews(id: string | number) {
|
||||
const payload = await apiRequest<PagedResult<ReviewDto> | ReviewDto[]>(`/lectures/${id}/reviews`)
|
||||
const payload = await apiRequest<PagedResult<ReviewDto> | ReviewDto[]>(
|
||||
`/lectures/${id}/reviews`,
|
||||
)
|
||||
return extractItems(payload)
|
||||
},
|
||||
}
|
||||
@@ -57,13 +66,15 @@ export const usersApi = {
|
||||
},
|
||||
stats: (id: string | number) => apiRequest<UserStatsDto>(`/users/${id}/stats`),
|
||||
async enrollments(id: string | number) {
|
||||
const payload = await apiRequest<PagedResult<LectureDto> | LectureDto[] | undefined>(`/users/${id}/enrollments`)
|
||||
const payload = await apiRequest<PagedResult<LectureDto> | LectureDto[] | undefined>(
|
||||
`/users/${id}/enrollments`,
|
||||
)
|
||||
return extractItems(payload)
|
||||
},
|
||||
async achievements(id: string | number) {
|
||||
const payload = await apiRequest<PagedResult<UserAchievementDto> | UserAchievementDto[] | AchievementDto[]>(
|
||||
`/users/${id}/achievements`,
|
||||
)
|
||||
const payload = await apiRequest<
|
||||
PagedResult<UserAchievementDto> | UserAchievementDto[] | AchievementDto[]
|
||||
>(`/users/${id}/achievements`)
|
||||
if (Array.isArray(payload)) return payload
|
||||
return payload.items ?? []
|
||||
},
|
||||
@@ -74,21 +85,31 @@ export const usersApi = {
|
||||
return extractItems(payload)
|
||||
},
|
||||
setRole: (id: string | number, roles: Array<'Student' | 'Teacher' | 'Admin'>) =>
|
||||
apiRequest<void>(`/users/${id}/role`, { method: 'PATCH', body: JSON.stringify(roles) }),
|
||||
apiRequest<void>(`/users/${id}/role`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(roles),
|
||||
}),
|
||||
setActive: (id: string | number, isActive: boolean) =>
|
||||
apiRequest<void>(`/users/${id}/active`, { method: 'PATCH', body: JSON.stringify(isActive) }),
|
||||
apiRequest<void>(`/users/${id}/active`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(isActive),
|
||||
}),
|
||||
}
|
||||
|
||||
export const achievementsApi = {
|
||||
async list() {
|
||||
const payload = await apiRequest<PagedResult<AchievementDto> | AchievementDto[]>('/achievements')
|
||||
const payload = await apiRequest<PagedResult<AchievementDto> | AchievementDto[]>(
|
||||
'/achievements',
|
||||
)
|
||||
return extractItems(payload)
|
||||
},
|
||||
}
|
||||
|
||||
export const notificationsApi = {
|
||||
async list() {
|
||||
const payload = await apiRequest<PagedResult<UserNotificationDto> | UserNotificationDto[]>('/notifications')
|
||||
const payload = await apiRequest<PagedResult<UserNotificationDto> | UserNotificationDto[]>(
|
||||
'/notifications',
|
||||
)
|
||||
return extractItems(payload)
|
||||
},
|
||||
markAllRead: () => apiRequest<void>('/notifications/read-all', { method: 'PATCH' }),
|
||||
@@ -104,12 +125,15 @@ export const reviewsApi = {
|
||||
const payload = await apiRequest<PagedResult<ReviewDto> | ReviewDto[]>('/reviews/pending')
|
||||
return extractItems(payload)
|
||||
},
|
||||
reanalyze: (id: string | number) => apiRequest<void>(`/reviews/${id}/reanalyze`, { method: 'POST' }),
|
||||
reanalyze: (id: string | number) =>
|
||||
apiRequest<void>(`/reviews/${id}/reanalyze`, { method: 'POST' }),
|
||||
}
|
||||
|
||||
export const coursesApi = {
|
||||
async list() {
|
||||
const payload = await apiRequest<PagedResult<CourseDto> | CourseDto[]>('/courses', { query: { PageSize: 100 } })
|
||||
const payload = await apiRequest<PagedResult<CourseDto> | CourseDto[]>('/courses', {
|
||||
query: { PageSize: 100 },
|
||||
})
|
||||
return extractItems(payload)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user