Skip to content

Commit a488030

Browse files
committed
build success resource
1 parent a74207a commit a488030

38 files changed

+1526
-2200
lines changed

src/app/app.routes.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AuthLayoutComponent } from './layouts/layout-pages/auth-layout/auth-lay
55
import { AppLayoutComponent } from './layouts/layout-pages/app-layout/app-layout.component';
66
import { AdminLayoutComponent } from './layouts/layout-pages/admin-layout/admin-layout';
77
import { RoleGuard } from './core/guards/router-protected/role.guard';
8-
import { ExerciseModule } from './features/excercise/exercise.module';
8+
import { PostModule } from './features/post/post.module';
99

1010
export const routes: Routes = [
1111
//Để test
@@ -86,6 +86,7 @@ export const routes: Routes = [
8686
],
8787
},
8888

89+
//Load app chính
8990
{
9091
path: '',
9192
component: AppLayoutComponent,
@@ -100,11 +101,10 @@ export const routes: Routes = [
100101
},
101102
{
102103
path: 'exercise',
103-
// loadChildren: () =>
104-
// import('./features/excercise/exercise.module').then(
105-
// (m) => m.ExerciseModule
106-
// ),
107-
loadChildren: () => ExerciseModule,
104+
loadChildren: () =>
105+
import('./features/excercise/exercise.module').then(
106+
(m) => m.ExerciseModule
107+
),
108108
},
109109
{
110110
path: 'conversations',
@@ -115,8 +115,14 @@ export const routes: Routes = [
115115
},
116116
{
117117
path: 'post-features',
118+
loadChildren: () => PostModule, //Load đầu tiên k dùng lazyload
119+
},
120+
{
121+
path: 'resource-learning',
118122
loadChildren: () =>
119-
import('./features/post/post.module').then((m) => m.PostModule),
123+
import('./features/resource-learning/resource-learning.module').then(
124+
(m) => m.ResourceLearningModule
125+
),
120126
},
121127
{
122128
path: 'profile',

src/app/core/models/api-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface XuanIPaginationResponse<T> {
4141
totalElements: number;
4242
hasPreviousPage: boolean;
4343
hasNextPage: boolean;
44-
datas: T;
44+
data: T;
4545
}
4646
export interface XuanPresignedUrlResponse {
4747
datas: {

src/app/core/models/resource.model.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { UserBasicInfo } from './exercise.model';
2+
13
export interface resourceCardInfo {
24
id: string;
35
avatarAuthor: string;
@@ -58,3 +60,35 @@ export interface IEpisodeLocal {
5860
export interface ILocalData {
5961
localData: IEpisodeLocal[];
6062
}
63+
64+
//--------------------updated structure type---------------
65+
export type MediaResource = {
66+
id: string;
67+
fileName: string;
68+
fileType: string;
69+
size: number;
70+
url: string;
71+
checksum: string;
72+
category: number;
73+
isActive: boolean;
74+
description: string;
75+
thumbnailUrl: string;
76+
transcodingStatus: string;
77+
associatedResourceIds: string[];
78+
tags: {
79+
id: string;
80+
name: string;
81+
}[];
82+
isLectureVideo: boolean;
83+
isTextbook: boolean;
84+
viewCount: number | null;
85+
rating: number | null;
86+
orgId: string | null;
87+
duration: number | null;
88+
hlsUrl: string | null;
89+
createdAt: string; // ISO date
90+
createdBy: string;
91+
organizationId: string | null;
92+
organizationRole: string;
93+
userProfile: UserBasicInfo;
94+
};

src/app/core/router-manager/horizontal-menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function getNavHorizontalItems(role: string): SidebarItem[] {
1919
},
2020
{
2121
id: 'resource',
22-
path: '/resource-management/resource-list',
22+
path: '/resource-learning/list-resource',
2323
label: 'Kho tài liệu',
2424
icon: 'fas fa-book',
2525
},
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { SidebarItem } from '../../models/data-handle';
2+
3+
export function sidebarResourceLearningRouter(role: string): SidebarItem[] {
4+
return [
5+
{
6+
id: 'resource',
7+
path: '/resource-learning/list-resource',
8+
label: 'danh sách tài nguyên',
9+
icon: 'fas fa-tasks',
10+
},
11+
{
12+
id: 'resource-save',
13+
path: '/resource-learning/resource-save',
14+
label: 'Tài nguyên đã lưu',
15+
icon: 'fas fa-bookmark',
16+
},
17+
];
18+
}

src/app/core/services/api-service/resource.service.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,37 @@ import {
66
XuanIPaginationResponse,
77
XuanPresignedUrlResponse,
88
} from '../../models/api-response';
9-
import { ResourceData, Tag } from '../../models/resource.model';
9+
import { MediaResource, ResourceData, Tag } from '../../models/resource.model';
1010
import { API_CONFIG } from '../config-service/api.enpoints';
1111

1212
@Injectable({
1313
providedIn: 'root',
1414
})
1515
export class ResourceService {
1616
constructor(private http: HttpClient, private api: ApiMethod) {}
17-
getResource(pageSize: number, pageIndex: number) {
17+
18+
//lỗi thời
19+
getAllResource(pageSize: number, pageIndex: number) {
1820
return this.api.post<ApiResponse<XuanIPaginationResponse<ResourceData[]>>>(
19-
API_CONFIG.ENDPOINTS.POST.GET_FILE,
21+
API_CONFIG.ENDPOINTS.POST.GET_ALL_FILE_RESOURCE,
2022
{
2123
pageIndex,
2224
pageSize,
2325
}
2426
);
2527
}
28+
29+
//bản cập nhật
30+
getAllResourceLearning(pageSize: number, pageIndex: number) {
31+
return this.api.post<ApiResponse<XuanIPaginationResponse<MediaResource[]>>>(
32+
API_CONFIG.ENDPOINTS.POST.GET_ALL_FILE_RESOURCE,
33+
{
34+
pageIndex,
35+
pageSize,
36+
}
37+
);
38+
}
39+
2640
getVideoResources() {
2741
return this.api.get<ApiResponse<ResourceData[]>>(
2842
API_CONFIG.ENDPOINTS.GET.GET_FILE_VIDEOS
@@ -34,7 +48,7 @@ export class ResourceService {
3448
);
3549
}
3650
getResourceById(id: string) {
37-
return this.api.get<ApiResponse<ResourceData>>(
51+
return this.api.get<ApiResponse<MediaResource>>(
3852
API_CONFIG.ENDPOINTS.GET.GET_FILE_BY_ID(id)
3953
);
4054
}

src/app/core/services/config-service/api.enpoints.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const API_CONFIG = {
118118
`/profile/social/followers?page=${page}&size=${size}`,
119119
GET_FOLLOWINGS: (page: number, size: number) =>
120120
`/profile/social/followings?page=${page}&size=${size}`,
121-
GET_FILE_BY_ID: (id: string) => `/file/api/FileDocument/${id}`,
121+
GET_FILE_BY_ID: (id: string) => `/file/api/FileDocument/file/${id}`,
122122
GET_RESOURCE_BY_ID: (id: string) => `/file/api/FileDocument/${id}`,
123123
GET_MY_THREADS: '/ai/chat/threads',
124124
GET_FILE_VIDEOS: '/file/api/FileDocument/videos',
@@ -181,8 +181,8 @@ export const API_CONFIG = {
181181
UPLOAD_BACKGROUND: `/profile/user/my-profile/background`,
182182
FOLLOWUSER: (targetUserId: string) =>
183183
`/profile/social/follow/${targetUserId}`,
184-
GET_FILE: `/file/api/FileDocument/public`,
185184
ADD_FILE: `/file/api/FileDocument/add`,
185+
GET_ALL_FILE_RESOURCE: '/file/api/FileDocument/public',
186186
ADD_POST: `/post/add`,
187187
GET_VISIBLE_POSTS: (page: number, size: number) =>
188188
`/post/view?page=${page}&size=${size}`,

src/app/features/admin/resources-management/component/popup-update/resource-edit-popup.component.scss

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)