diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts index a49eb1c..5fd0efe 100644 --- a/src/app/app.routing.ts +++ b/src/app/app.routing.ts @@ -430,11 +430,11 @@ export const appRoutes: Route[] = [ ).then((m: any) => m.UserSessionModule), }, { - path: 'sessionin-overlap', + path: 'duplicated-session', loadChildren: () => import( - 'app/modules/admin/report/sessionin-overlap/sessionin-overlap.module' - ).then((m: any) => m.SessioninOverlapModule), + 'app/modules/admin/report/duplicated-session/duplicated-session.module' + ).then((m: any) => m.DuplicatedSessionModule), }, { path: 'admin-session', diff --git a/src/app/mock-api/apps/report/sessionin-overlap/api.ts b/src/app/mock-api/apps/report/duplicated-session/api.ts similarity index 62% rename from src/app/mock-api/apps/report/sessionin-overlap/api.ts rename to src/app/mock-api/apps/report/duplicated-session/api.ts index ef4d177..c93c792 100644 --- a/src/app/mock-api/apps/report/sessionin-overlap/api.ts +++ b/src/app/mock-api/apps/report/duplicated-session/api.ts @@ -1,13 +1,13 @@ import { Injectable } from '@angular/core'; import { assign, cloneDeep } from 'lodash-es'; import { FuseMockApiService, FuseMockApiUtils } from '@fuse/lib/mock-api'; -import { sessioninOverlaps as sessioninOverlapsData } from './data'; +import { duplicatedSessions as duplicatedSessionsData } from './data'; @Injectable({ providedIn: 'root', }) -export class ReportSessioninOverlapMockApi { - private _sessioninOverlaps: any[] = sessioninOverlapsData; +export class ReportDuplicatedSessionMockApi { + private _duplicatedSessions: any[] = duplicatedSessionsData; /** * Constructor @@ -26,26 +26,26 @@ export class ReportSessioninOverlapMockApi { */ registerHandlers(): void { // ----------------------------------------------------------------------------------------------------- - // @ SessioninOverlaps - GET + // @ DuplicatedSessions - GET // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onGet('api/apps/report/sessionin-overlap/sessionin-overlaps', 300) + .onGet('api/apps/report/duplicated-session/duplicated-sessions', 300) .reply(({ request }) => { // Get available queries const search = request.params.get('search'); - const sort = request.params.get('sort') || 'name'; + const sort = request.params.get('sort') || 'overlapCount'; const order = request.params.get('order') || 'asc'; const page = parseInt(request.params.get('page') ?? '1', 10); const size = parseInt(request.params.get('size') ?? '10', 10); - // Clone the sessioninoverlaps - let sessioninOverlaps: any[] | null = cloneDeep( - this._sessioninOverlaps + // Clone the duplicatedSessions + let duplicatedSessions: any[] | null = cloneDeep( + this._duplicatedSessions ); - // Sort the sessioninOverlaps + // Sort the duplicatedSessions if (sort === 'overlapCount') { - sessioninOverlaps.sort((a, b) => { + duplicatedSessions.sort((a, b) => { const fieldA = a[sort].toString().toUpperCase(); const fieldB = b[sort].toString().toUpperCase(); return order === 'asc' @@ -53,15 +53,15 @@ export class ReportSessioninOverlapMockApi { : fieldB.localeCompare(fieldA); }); } else { - sessioninOverlaps.sort((a, b) => + duplicatedSessions.sort((a, b) => order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort] ); } // If search exists... if (search) { - // Filter the sessioninOverlaps - sessioninOverlaps = sessioninOverlaps.filter( + // Filter the duplicatedSessions + duplicatedSessions = duplicatedSessions.filter( (contact: any) => contact.name && contact.name.toLowerCase().includes(search.toLowerCase()) @@ -69,32 +69,35 @@ export class ReportSessioninOverlapMockApi { } // Paginate - Start - const sessioninOverlapsLength = sessioninOverlaps.length; + const duplicatedSessionsLength = duplicatedSessions.length; // Calculate pagination details const begin = page * size; - const end = Math.min(size * (page + 1), sessioninOverlapsLength); - const lastPage = Math.max(Math.ceil(sessioninOverlapsLength / size), 1); + const end = Math.min(size * (page + 1), duplicatedSessionsLength); + const lastPage = Math.max( + Math.ceil(duplicatedSessionsLength / size), + 1 + ); // Prepare the pagination object let pagination = {}; // If the requested page number is bigger than // the last possible page number, return null for - // sessioninOverlaps but also send the last possible page so + // duplicatedSessions but also send the last possible page so // the app can navigate to there if (page > lastPage) { - sessioninOverlaps = null; + duplicatedSessions = null; pagination = { lastPage, }; } else { // Paginate the results by size - sessioninOverlaps = sessioninOverlaps.slice(begin, end); + duplicatedSessions = duplicatedSessions.slice(begin, end); // Prepare the pagination mock-api pagination = { - length: sessioninOverlapsLength, + length: duplicatedSessionsLength, size: size, page: page, lastPage: lastPage, @@ -107,41 +110,41 @@ export class ReportSessioninOverlapMockApi { return [ 200, { - sessioninOverlaps, + duplicatedSessions, pagination, }, ]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninOverlap - GET + // @ DuplicatedSession - GET // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onGet('api/apps/report/sessionin-overlap/sessionin-overlap') + .onGet('api/apps/report/duplicated-session/duplicated-session') .reply(({ request }) => { // Get the id from the params const id = request.params.get('id'); - // Clone the sessioninOverlaps - const sessioninOverlaps = cloneDeep(this._sessioninOverlaps); + // Clone the duplicatedSessions + const duplicatedSessions = cloneDeep(this._duplicatedSessions); - // Find the sessioninOverlap - const sessioninOverlap = sessioninOverlaps.find( + // Find the duplicatedSession + const duplicatedSession = duplicatedSessions.find( (item: any) => item.id === id ); // Return the response - return [200, sessioninOverlap]; + return [200, duplicatedSession]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninOverlap - POST + // @ DuplicatedSession - POST // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onPost('api/apps/report/sessionin-overlap/sessionin-overlap') + .onPost('api/apps/report/duplicated-session/duplicated-session') .reply(() => { - // Generate a new sessioninOverlap - const newSessioninOverlap = { + // Generate a new duplicatedSession + const newDuplicatedSession = { id: FuseMockApiUtils.guid(), category: '', name: 'A New User', @@ -163,58 +166,58 @@ export class ReportSessioninOverlapMockApi { active: false, }; - // Unshift the new sessioninOverlap - this._sessioninOverlaps.unshift(newSessioninOverlap); + // Unshift the new duplicatedSession + this._duplicatedSessions.unshift(newDuplicatedSession); // Return the response - return [200, newSessioninOverlap]; + return [200, newDuplicatedSession]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninOverlap - PATCH + // @ DuplicatedSession - PATCH // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onPatch('api/apps/report/sessionin-overlap/sessionin-overlap') + .onPatch('api/apps/report/duplicated-session/duplicated-session') .reply(({ request }) => { - // Get the id and sessioninOverlap + // Get the id and duplicatedSession const id = request.body.id; - const sessioninOverlap = cloneDeep(request.body.sessioninOverlap); + const duplicatedSession = cloneDeep(request.body.duplicatedSession); - // Prepare the updated sessioninOverlap - let updatedSessioninOverlap = null; + // Prepare the updated duplicatedSession + let updatedDuplicatedSession = null; - // Find the sessioninOverlap and update it - this._sessioninOverlaps.forEach((item, index, sessioninOverlaps) => { + // Find the duplicatedSession and update it + this._duplicatedSessions.forEach((item, index, duplicatedSessions) => { if (item.id === id) { - // Update the sessioninOverlap - sessioninOverlaps[index] = assign( + // Update the duplicatedSession + duplicatedSessions[index] = assign( {}, - sessioninOverlaps[index], - sessioninOverlap + duplicatedSessions[index], + duplicatedSession ); - // Store the updated sessioninOverlap - updatedSessioninOverlap = sessioninOverlaps[index]; + // Store the updated duplicatedSession + updatedDuplicatedSession = duplicatedSessions[index]; } }); // Return the response - return [200, updatedSessioninOverlap]; + return [200, updatedDuplicatedSession]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninOverlap - DELETE + // @ DuplicatedSession - DELETE // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onDelete('api/apps/report/sessionin-overlap/sessionin-overlap') + .onDelete('api/apps/report/duplicated-session/duplicated-session') .reply(({ request }) => { // Get the id const id = request.params.get('id'); - // Find the sessioninOverlap and delete it - this._sessioninOverlaps.forEach((item, index) => { + // Find the duplicatedSession and delete it + this._duplicatedSessions.forEach((item, index) => { if (item.id === id) { - this._sessioninOverlaps.splice(index, 1); + this._duplicatedSessions.splice(index, 1); } }); diff --git a/src/app/mock-api/apps/report/sessionin-overlap/data.ts b/src/app/mock-api/apps/report/duplicated-session/data.ts similarity index 98% rename from src/app/mock-api/apps/report/sessionin-overlap/data.ts rename to src/app/mock-api/apps/report/duplicated-session/data.ts index 1dc5f38..743121c 100644 --- a/src/app/mock-api/apps/report/sessionin-overlap/data.ts +++ b/src/app/mock-api/apps/report/duplicated-session/data.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -export const sessioninOverlaps = [ +export const duplicatedSessions = [ { id: '1', overlapCount: '3', diff --git a/src/app/mock-api/common/navigation/data.ts b/src/app/mock-api/common/navigation/data.ts index ab2bc9c..4f0a539 100644 --- a/src/app/mock-api/common/navigation/data.ts +++ b/src/app/mock-api/common/navigation/data.ts @@ -322,11 +322,11 @@ export const defaultNavigation: FuseNavigationItem[] = [ link: '/report/user-session', }, { - id: 'report.sessionin-overlap', - title: 'Sessionin Overlap', + id: 'report.duplicated-session', + title: 'Duplicated Session', type: 'basic', icon: 'heroicons_outline:academic-cap', - link: '/report/sessionin-overlap', + link: '/report/duplicated-session', }, { id: 'report.admin-session', diff --git a/src/app/mock-api/index.ts b/src/app/mock-api/index.ts index 6c7e565..0af8229 100644 --- a/src/app/mock-api/index.ts +++ b/src/app/mock-api/index.ts @@ -59,7 +59,7 @@ import { ReportCompLogMockApi } from './apps/report/comp-log/api'; import { ReportModificationLogMockApi } from './apps/report/modification-log/api'; import { ReportPaymentLogMockApi } from './apps/report/payment-log/api'; import { ReportUserSessionMockApi } from './apps/report/user-session/api'; -import { ReportSessioninOverlapMockApi } from './apps/report/sessionin-overlap/api'; +import { ReportDuplicatedSessionMockApi } from './apps/report/duplicated-session/api'; import { ReportAdminSessionMockApi } from './apps/report/admin-session/api'; import { ReportExcelLogMockApi } from './apps/report/excel-log/api'; import { ReportLoosingMockApi } from './apps/report/loosing/api'; @@ -132,7 +132,7 @@ export const mockApiServices = [ ReportModificationLogMockApi, ReportPaymentLogMockApi, ReportUserSessionMockApi, - ReportSessioninOverlapMockApi, + ReportDuplicatedSessionMockApi, ReportAdminSessionMockApi, ReportExcelLogMockApi, ReportLoosingMockApi, diff --git a/src/app/modules/admin/report/sessionin-overlap/components/index.ts b/src/app/modules/admin/report/duplicated-session/components/index.ts similarity index 100% rename from src/app/modules/admin/report/sessionin-overlap/components/index.ts rename to src/app/modules/admin/report/duplicated-session/components/index.ts diff --git a/src/app/modules/admin/report/sessionin-overlap/components/list.component.html b/src/app/modules/admin/report/duplicated-session/components/list.component.html similarity index 92% rename from src/app/modules/admin/report/sessionin-overlap/components/list.component.html rename to src/app/modules/admin/report/duplicated-session/components/list.component.html index c4c7556..88c5839 100644 --- a/src/app/modules/admin/report/sessionin-overlap/components/list.component.html +++ b/src/app/modules/admin/report/duplicated-session/components/list.component.html @@ -65,8 +65,10 @@
- - + +
- +
diff --git a/src/app/modules/admin/report/sessionin-overlap/components/list.component.ts b/src/app/modules/admin/report/duplicated-session/components/list.component.ts similarity index 84% rename from src/app/modules/admin/report/sessionin-overlap/components/list.component.ts rename to src/app/modules/admin/report/duplicated-session/components/list.component.ts index 5829838..9233874 100644 --- a/src/app/modules/admin/report/sessionin-overlap/components/list.component.ts +++ b/src/app/modules/admin/report/duplicated-session/components/list.component.ts @@ -30,13 +30,13 @@ import { fuseAnimations } from '@fuse/animations'; import { FuseConfirmationService } from '@fuse/services/confirmation'; import { User } from '../../../member/user/models/user'; -import { SessioninOverlap } from '../models/sessionin-overlap'; -import { SessioninOverlapPagination } from '../models/sessionin-Overlap-pagination'; -import { SessioninOverlapService } from '../services/sessionin-overlap.service'; +import { DuplicatedSession } from '../models/duplicated-session'; +import { DuplicatedSessionPagination } from '../models/duplicated-session-pagination'; +import { DuplicatedSessionService } from '../services/duplicated-session.service'; import { Router } from '@angular/router'; @Component({ - selector: 'sessionin-overlap-list', + selector: 'duplicated-session-list', templateUrl: './list.component.html', styles: [ /* language=SCSS */ @@ -66,13 +66,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild(MatPaginator) private _paginator!: MatPaginator; @ViewChild(MatSort) private _sort!: MatSort; - sessioninOverlaps$!: Observable; + duplicatedSessions$!: Observable; users$!: Observable; isLoading = false; searchInputControl = new FormControl(); - selectedSessioninOverlap?: SessioninOverlap; - pagination?: SessioninOverlapPagination; + selectedDuplicatedSession?: DuplicatedSession; + pagination?: DuplicatedSessionPagination; __isSearchOpened = false; @@ -85,7 +85,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { private _changeDetectorRef: ChangeDetectorRef, private _fuseConfirmationService: FuseConfirmationService, private _formBuilder: FormBuilder, - private _sessioninOverlapService: SessioninOverlapService, + private _duplicatedSessionService: DuplicatedSessionService, private router: Router ) {} @@ -98,9 +98,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { */ ngOnInit(): void { // Get the pagination - this._sessioninOverlapService.pagination$ + this._duplicatedSessionService.pagination$ .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((pagination: SessioninOverlapPagination | undefined) => { + .subscribe((pagination: DuplicatedSessionPagination | undefined) => { // Update the pagination this.pagination = pagination; @@ -109,7 +109,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { }); // Get the products - this.sessioninOverlaps$ = this._sessioninOverlapService.sessioninOverlaps$; + this.duplicatedSessions$ = + this._duplicatedSessionService.duplicatedSessions$; } /** @@ -119,7 +120,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { if (this._sort && this._paginator) { // Set the initial sort this._sort.sort({ - id: 'name', + id: 'overlapCount', start: 'asc', disableClear: true, }); @@ -127,7 +128,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { // Mark for check this._changeDetectorRef.markForCheck(); - // If the sessioninOverlap changes the sort order... + // If the duplicatedSession changes the sort order... this._sort.sortChange .pipe(takeUntil(this._unsubscribeAll)) .subscribe(() => { @@ -140,7 +141,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { .pipe( switchMap(() => { this.isLoading = true; - return this._sessioninOverlapService.getSessioninOverlaps( + return this._duplicatedSessionService.getDuplicatedSessions( this._paginator.pageIndex, this._paginator.pageSize, this._sort.active, diff --git a/src/app/modules/admin/report/sessionin-overlap/sessionin-overlap.module.ts b/src/app/modules/admin/report/duplicated-session/duplicated-session.module.ts similarity index 90% rename from src/app/modules/admin/report/sessionin-overlap/sessionin-overlap.module.ts rename to src/app/modules/admin/report/duplicated-session/duplicated-session.module.ts index 0b3825c..c135c6f 100644 --- a/src/app/modules/admin/report/sessionin-overlap/sessionin-overlap.module.ts +++ b/src/app/modules/admin/report/duplicated-session/duplicated-session.module.ts @@ -22,14 +22,14 @@ import { SharedModule } from 'app/shared/shared.module'; import { COMPONENTS } from './components'; -import { sessioninOverlapRoutes } from './sessionin-overlap.routing'; +import { duplicatedSessionRoutes } from './duplicated-session.routing'; @NgModule({ declarations: [COMPONENTS], imports: [ TranslocoModule, SharedModule, - RouterModule.forChild(sessioninOverlapRoutes), + RouterModule.forChild(duplicatedSessionRoutes), MatButtonModule, MatFormFieldModule, @@ -47,4 +47,4 @@ import { sessioninOverlapRoutes } from './sessionin-overlap.routing'; MatCheckboxModule, ], }) -export class SessioninOverlapModule {} +export class DuplicatedSessionModule {} diff --git a/src/app/modules/admin/report/sessionin-overlap/sessionin-overlap.routing.ts b/src/app/modules/admin/report/duplicated-session/duplicated-session.routing.ts similarity index 69% rename from src/app/modules/admin/report/sessionin-overlap/sessionin-overlap.routing.ts rename to src/app/modules/admin/report/duplicated-session/duplicated-session.routing.ts index 9411951..ccdb895 100644 --- a/src/app/modules/admin/report/sessionin-overlap/sessionin-overlap.routing.ts +++ b/src/app/modules/admin/report/duplicated-session/duplicated-session.routing.ts @@ -3,15 +3,15 @@ import { Route } from '@angular/router'; import { ListComponent } from './components/list.component'; import { ViewComponent } from '../../member/user/components/view.component'; -import { SessioninOverlapsResolver } from './resolvers/sessionin-overlap.resolver'; +import { DuplicatedSessionsResolver } from './resolvers/duplicated-session.resolver'; import { UserResolver } from '../../member/user/resolvers/user.resolver'; -export const sessioninOverlapRoutes: Route[] = [ +export const duplicatedSessionRoutes: Route[] = [ { path: '', component: ListComponent, resolve: { - sessioninOverlaps: SessioninOverlapsResolver, + duplicatedSessions: DuplicatedSessionsResolver, }, }, { diff --git a/src/app/modules/admin/report/sessionin-overlap/models/sessionin-Overlap-pagination.ts b/src/app/modules/admin/report/duplicated-session/models/duplicated-session-pagination.ts similarity index 70% rename from src/app/modules/admin/report/sessionin-overlap/models/sessionin-Overlap-pagination.ts rename to src/app/modules/admin/report/duplicated-session/models/duplicated-session-pagination.ts index 0e12fc4..8e2ccfe 100644 --- a/src/app/modules/admin/report/sessionin-overlap/models/sessionin-Overlap-pagination.ts +++ b/src/app/modules/admin/report/duplicated-session/models/duplicated-session-pagination.ts @@ -1,4 +1,4 @@ -export interface SessioninOverlapPagination { +export interface DuplicatedSessionPagination { length: number; size: number; page: number; diff --git a/src/app/modules/admin/report/sessionin-overlap/models/sessionin-overlap.ts b/src/app/modules/admin/report/duplicated-session/models/duplicated-session.ts similarity index 66% rename from src/app/modules/admin/report/sessionin-overlap/models/sessionin-overlap.ts rename to src/app/modules/admin/report/duplicated-session/models/duplicated-session.ts index c97557b..4698cbf 100644 --- a/src/app/modules/admin/report/sessionin-overlap/models/sessionin-overlap.ts +++ b/src/app/modules/admin/report/duplicated-session/models/duplicated-session.ts @@ -1,4 +1,4 @@ -export interface SessioninOverlap { +export interface DuplicatedSession { id?: string; overlapCount?: string; ip?: string; diff --git a/src/app/modules/admin/report/sessionin-overlap/resolvers/sessionin-overlap.resolver.ts b/src/app/modules/admin/report/duplicated-session/resolvers/duplicated-session.resolver.ts similarity index 66% rename from src/app/modules/admin/report/sessionin-overlap/resolvers/sessionin-overlap.resolver.ts rename to src/app/modules/admin/report/duplicated-session/resolvers/duplicated-session.resolver.ts index 476cb16..f75a639 100644 --- a/src/app/modules/admin/report/sessionin-overlap/resolvers/sessionin-overlap.resolver.ts +++ b/src/app/modules/admin/report/duplicated-session/resolvers/duplicated-session.resolver.ts @@ -7,19 +7,19 @@ import { } from '@angular/router'; import { catchError, Observable, throwError } from 'rxjs'; -import { SessioninOverlap } from '../models/sessionin-overlap'; -import { SessioninOverlapPagination } from '../models/sessionin-Overlap-pagination'; -import { SessioninOverlapService } from '../services/sessionin-overlap.service'; +import { DuplicatedSession } from '../models/duplicated-session'; +import { DuplicatedSessionPagination } from '../models/duplicated-session-pagination'; +import { DuplicatedSessionService } from '../services/duplicated-session.service'; @Injectable({ providedIn: 'root', }) -export class SessioninOverlapResolver implements Resolve { +export class DuplicatedSessionResolver implements Resolve { /** * Constructor */ constructor( - private _sessioninOverlapService: SessioninOverlapService, + private _duplicatedSessionService: DuplicatedSessionService, private _router: Router ) {} @@ -36,9 +36,9 @@ export class SessioninOverlapResolver implements Resolve { resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot - ): Observable { - return this._sessioninOverlapService - .getSessioninOverlapById(route.paramMap.get('id')) + ): Observable { + return this._duplicatedSessionService + .getDuplicatedSessionById(route.paramMap.get('id')) .pipe( // Error here means the requested product is not available catchError((error) => { @@ -61,11 +61,11 @@ export class SessioninOverlapResolver implements Resolve { @Injectable({ providedIn: 'root', }) -export class SessioninOverlapsResolver implements Resolve { +export class DuplicatedSessionsResolver implements Resolve { /** * Constructor */ - constructor(private _sessioninOverlapService: SessioninOverlapService) {} + constructor(private _duplicatedSessionService: DuplicatedSessionService) {} // ----------------------------------------------------------------------------------------------------- // @ Public methods @@ -81,9 +81,9 @@ export class SessioninOverlapsResolver implements Resolve { route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable<{ - pagination: SessioninOverlapPagination; - sessioninOverlaps: SessioninOverlap[]; + pagination: DuplicatedSessionPagination; + duplicatedSessions: DuplicatedSession[]; }> { - return this._sessioninOverlapService.getSessioninOverlaps(); + return this._duplicatedSessionService.getDuplicatedSessions(); } } diff --git a/src/app/modules/admin/report/sessionin-overlap/services/sessionin-overlap.service.ts b/src/app/modules/admin/report/duplicated-session/services/duplicated-session.service.ts similarity index 50% rename from src/app/modules/admin/report/sessionin-overlap/services/sessionin-overlap.service.ts rename to src/app/modules/admin/report/duplicated-session/services/duplicated-session.service.ts index 94b31f6..4936390 100644 --- a/src/app/modules/admin/report/sessionin-overlap/services/sessionin-overlap.service.ts +++ b/src/app/modules/admin/report/duplicated-session/services/duplicated-session.service.ts @@ -12,22 +12,22 @@ import { throwError, } from 'rxjs'; -import { SessioninOverlap } from '../models/sessionin-overlap'; -import { SessioninOverlapPagination } from '../models/sessionin-Overlap-pagination'; +import { DuplicatedSession } from '../models/duplicated-session'; +import { DuplicatedSessionPagination } from '../models/duplicated-session-pagination'; @Injectable({ providedIn: 'root', }) -export class SessioninOverlapService { +export class DuplicatedSessionService { // Private private __pagination = new BehaviorSubject< - SessioninOverlapPagination | undefined + DuplicatedSessionPagination | undefined >(undefined); - private __sessioninOverlap = new BehaviorSubject< - SessioninOverlap | undefined + private __duplicatedSession = new BehaviorSubject< + DuplicatedSession | undefined >(undefined); - private __sessioninOverlaps = new BehaviorSubject< - SessioninOverlap[] | undefined + private __duplicatedSessions = new BehaviorSubject< + DuplicatedSession[] | undefined >(undefined); /** @@ -42,22 +42,22 @@ export class SessioninOverlapService { /** * Getter for pagination */ - get pagination$(): Observable { + get pagination$(): Observable { return this.__pagination.asObservable(); } /** - * Getter for sessioninOverlap + * Getter for duplicatedSession */ - get sessioninOverlap$(): Observable { - return this.__sessioninOverlap.asObservable(); + get duplicatedSession$(): Observable { + return this.__duplicatedSession.asObservable(); } /** - * Getter for sessioninOverlaps + * Getter for duplicatedSessions */ - get sessioninOverlaps$(): Observable { - return this.__sessioninOverlaps.asObservable(); + get duplicatedSessions$(): Observable { + return this.__duplicatedSessions.asObservable(); } // ----------------------------------------------------------------------------------------------------- @@ -65,7 +65,7 @@ export class SessioninOverlapService { // ----------------------------------------------------------------------------------------------------- /** - * Get SessioninOverlaps + * Get DuplicatedSessions * * * @param page @@ -74,21 +74,21 @@ export class SessioninOverlapService { * @param order * @param search */ - getSessioninOverlaps( + getDuplicatedSessions( page: number = 0, size: number = 10, - sort: string = 'name', + sort: string = 'signinId', order: 'asc' | 'desc' | '' = 'asc', search: string = '' ): Observable<{ - pagination: SessioninOverlapPagination; - sessioninOverlaps: SessioninOverlap[]; + pagination: DuplicatedSessionPagination; + duplicatedSessions: DuplicatedSession[]; }> { return this._httpClient .get<{ - pagination: SessioninOverlapPagination; - sessioninOverlaps: SessioninOverlap[]; - }>('api/apps/report/sessionin-overlap/sessionin-overlaps', { + pagination: DuplicatedSessionPagination; + duplicatedSessions: DuplicatedSession[]; + }>('api/apps/report/duplicated-session/duplicated-sessions', { params: { page: '' + page, size: '' + size, @@ -100,7 +100,7 @@ export class SessioninOverlapService { .pipe( tap((response) => { this.__pagination.next(response.pagination); - this.__sessioninOverlaps.next(response.sessioninOverlaps); + this.__duplicatedSessions.next(response.duplicatedSessions); }) ); } @@ -108,19 +108,19 @@ export class SessioninOverlapService { /** * Get product by id */ - getSessioninOverlapById(id: string | null): Observable { - return this.__sessioninOverlaps.pipe( + getDuplicatedSessionById(id: string | null): Observable { + return this.__duplicatedSessions.pipe( take(1), - map((sessioninOverlaps) => { + map((duplicatedSessions) => { // Find the product - const sessioninOverlap = - sessioninOverlaps?.find((item) => item.id === id) || undefined; + const duplicatedSession = + duplicatedSessions?.find((item) => item.id === id) || undefined; // Update the product - this.__sessioninOverlap.next(sessioninOverlap); + this.__duplicatedSession.next(duplicatedSession); // Return the product - return sessioninOverlap; + return duplicatedSession; }), switchMap((product) => { if (!product) { @@ -135,27 +135,27 @@ export class SessioninOverlapService { /** * Create product */ - createSessioninOverlap(): Observable { - return this.sessioninOverlaps$.pipe( + createDuplicatedSession(): Observable { + return this.duplicatedSessions$.pipe( take(1), - switchMap((sessioninOverlaps) => + switchMap((duplicatedSessions) => this._httpClient - .post( - 'api/apps/report/sessionin-overlap/product', + .post( + 'api/apps/report/duplicated-session/product', {} ) .pipe( - map((newSessioninOverlap) => { - // Update the sessioninOverlaps with the new product - if (!!sessioninOverlaps) { - this.__sessioninOverlaps.next([ - newSessioninOverlap, - ...sessioninOverlaps, + map((newDuplicatedSession) => { + // Update the duplicatedSessions with the new product + if (!!duplicatedSessions) { + this.__duplicatedSessions.next([ + newDuplicatedSession, + ...duplicatedSessions, ]); } // Return the new product - return newSessioninOverlap; + return newDuplicatedSession; }) ) ) diff --git a/src/app/modules/admin/report/user-session/components/list.component.ts b/src/app/modules/admin/report/user-session/components/list.component.ts index 7ea21c4..6778a0c 100644 --- a/src/app/modules/admin/report/user-session/components/list.component.ts +++ b/src/app/modules/admin/report/user-session/components/list.component.ts @@ -36,7 +36,7 @@ import { UserSessionService } from '../services/user-session.service'; import { Router } from '@angular/router'; @Component({ - selector: 'sessionin-info-list', + selector: 'user-session-list', templateUrl: './list.component.html', styles: [ /* language=SCSS */ diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index c03db86..ee08612 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -39,7 +39,7 @@ "Payment Log": "Manual Payment Logs", "User Session": "User Session", "Admin Session": "Admin Session", - "Sessionin Overlap": "Sessionin Overlap", + "Duplicated Session": "Duplicated Session", "Excel Log": "Excel Download Logs", "Loosing": "Loosing Management", "Notice": "Notice", diff --git a/src/assets/i18n/ko.json b/src/assets/i18n/ko.json index 34b079c..c80298c 100644 --- a/src/assets/i18n/ko.json +++ b/src/assets/i18n/ko.json @@ -46,7 +46,7 @@ "Modification Log": "회원수정 로그", "Payment Log": "수동지급/회수 로그", "User Session": "로그인정보", - "Sessionin Overlap": "중복로그인", + "Duplicated Session": "중복로그인", "Admin Session": "관리자 로그인정보", "Excel Log": "엑셀다운 로그", "Loosing": "루징관리",