From ce51b9e44f5d78ce3a46b80cc547a6d12ecd108b Mon Sep 17 00:00:00 2001 From: JUNG YI DAM Date: Thu, 4 Aug 2022 08:40:45 +0000 Subject: [PATCH] =?UTF-8?q?=ED=8F=B4=EB=8D=94=EB=AA=85=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.routing.ts | 6 +- .../{sessionin-admin => admin-session}/api.ts | 110 +++++++++--------- .../data.ts | 2 +- src/app/mock-api/common/navigation/data.ts | 6 +- src/app/mock-api/index.ts | 4 +- .../admin-session.module.ts} | 6 +- .../admin-session.routing.ts} | 6 +- .../components/index.ts | 0 .../components/list.component.html | 10 +- .../components/list.component.ts | 22 ++-- .../models/admin-session-pagination.ts} | 2 +- .../models/admin-session.ts} | 2 +- .../resolvers/admin-session.resolver.ts} | 26 ++--- .../services/admin-session.service.ts} | 77 ++++++------ src/assets/i18n/en.json | 2 +- src/assets/i18n/ko.json | 2 +- 16 files changed, 139 insertions(+), 144 deletions(-) rename src/app/mock-api/apps/report/{sessionin-admin => admin-session}/api.ts (64%) rename src/app/mock-api/apps/report/{sessionin-admin => admin-session}/data.ts (97%) rename src/app/modules/admin/report/{sessionin-admin/sessionin-admin.module.ts => admin-session/admin-session.module.ts} (91%) rename src/app/modules/admin/report/{sessionin-admin/sessionin-admin.routing.ts => admin-session/admin-session.routing.ts} (71%) rename src/app/modules/admin/report/{sessionin-admin => admin-session}/components/index.ts (100%) rename src/app/modules/admin/report/{sessionin-admin => admin-session}/components/list.component.html (96%) rename src/app/modules/admin/report/{sessionin-admin => admin-session}/components/list.component.ts (90%) rename src/app/modules/admin/report/{sessionin-admin/models/sessionin-admin-pagination.ts => admin-session/models/admin-session-pagination.ts} (72%) rename src/app/modules/admin/report/{sessionin-admin/models/sessionin-admin.ts => admin-session/models/admin-session.ts} (86%) rename src/app/modules/admin/report/{sessionin-admin/resolvers/sessionin-admin.resolver.ts => admin-session/resolvers/admin-session.resolver.ts} (68%) rename src/app/modules/admin/report/{sessionin-admin/services/sessionin-admin.service.ts => admin-session/services/admin-session.service.ts} (52%) diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts index f259c06..c1cb18a 100644 --- a/src/app/app.routing.ts +++ b/src/app/app.routing.ts @@ -437,11 +437,11 @@ export const appRoutes: Route[] = [ ).then((m: any) => m.SessioninOverlapModule), }, { - path: 'sessionin-admin', + path: 'admin-session', loadChildren: () => import( - 'app/modules/admin/report/sessionin-admin/sessionin-admin.module' - ).then((m: any) => m.SessioninAdminModule), + 'app/modules/admin/report/admin-session/admin-session.module' + ).then((m: any) => m.AdminSessionModule), }, { path: 'excel-log', diff --git a/src/app/mock-api/apps/report/sessionin-admin/api.ts b/src/app/mock-api/apps/report/admin-session/api.ts similarity index 64% rename from src/app/mock-api/apps/report/sessionin-admin/api.ts rename to src/app/mock-api/apps/report/admin-session/api.ts index dbab087..859f579 100644 --- a/src/app/mock-api/apps/report/sessionin-admin/api.ts +++ b/src/app/mock-api/apps/report/admin-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 { sessioninAdmins as sessioninAdminsData } from './data'; +import { adminSessions as adminSessionsData } from './data'; @Injectable({ providedIn: 'root', }) -export class ReportSessioninAdminMockApi { - private _sessioninAdmins: any[] = sessioninAdminsData; +export class ReportAdminSessionMockApi { + private _adminSessions: any[] = adminSessionsData; /** * Constructor @@ -26,10 +26,10 @@ export class ReportSessioninAdminMockApi { */ registerHandlers(): void { // ----------------------------------------------------------------------------------------------------- - // @ SessioninAdmins - GET + // @ AdminSessions - GET // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onGet('api/apps/report/sessionin-admin/sessionin-admins', 300) + .onGet('api/apps/report/admin-session/admin-sessions', 300) .reply(({ request }) => { // Get available queries const search = request.params.get('search'); @@ -38,12 +38,12 @@ export class ReportSessioninAdminMockApi { const page = parseInt(request.params.get('page') ?? '1', 10); const size = parseInt(request.params.get('size') ?? '10', 10); - // Clone the sessioninAdmins - let sessioninAdmins: any[] | null = cloneDeep(this._sessioninAdmins); + // Clone the adminSessions + let adminSessions: any[] | null = cloneDeep(this._adminSessions); - // Sort the sessioninAdmins + // Sort the adminSessions // if (sort === 'sku' || sort === 'name' || sort === 'active') { - // sessioninAdmins.sort((a, b) => { + // adminSessions.sort((a, b) => { // const fieldA = a[sort].toString().toUpperCase(); // const fieldB = b[sort].toString().toUpperCase(); // return order === 'asc' @@ -51,15 +51,15 @@ export class ReportSessioninAdminMockApi { // : fieldB.localeCompare(fieldA); // }); // } else { - // sessioninAdmins.sort((a, b) => + // adminSessions.sort((a, b) => // order === 'asc' ? a[sort] - b[sort] : b[sort] - a[sort] // ); // } // If search exists... if (search) { - // Filter the sessioninAdmins - sessioninAdmins = sessioninAdmins.filter( + // Filter the adminSessions + adminSessions = adminSessions.filter( (contact: any) => contact.name && contact.name.toLowerCase().includes(search.toLowerCase()) @@ -67,32 +67,32 @@ export class ReportSessioninAdminMockApi { } // Paginate - Start - const sessioninAdminsLength = sessioninAdmins.length; + const adminSessionsLength = adminSessions.length; // Calculate pagination details const begin = page * size; - const end = Math.min(size * (page + 1), sessioninAdminsLength); - const lastPage = Math.max(Math.ceil(sessioninAdminsLength / size), 1); + const end = Math.min(size * (page + 1), adminSessionsLength); + const lastPage = Math.max(Math.ceil(adminSessionsLength / size), 1); // Prepare the pagination object let pagination = {}; // If the requested page number is bigger than // the last possible page number, return null for - // sessioninAdmins but also send the last possible page so + // adminSessions but also send the last possible page so // the app can navigate to there if (page > lastPage) { - sessioninAdmins = null; + adminSessions = null; pagination = { lastPage, }; } else { // Paginate the results by size - sessioninAdmins = sessioninAdmins.slice(begin, end); + adminSessions = adminSessions.slice(begin, end); // Prepare the pagination mock-api pagination = { - length: sessioninAdminsLength, + length: adminSessionsLength, size: size, page: page, lastPage: lastPage, @@ -105,41 +105,39 @@ export class ReportSessioninAdminMockApi { return [ 200, { - sessioninAdmins, + adminSessions, pagination, }, ]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninAdmin - GET + // @ AdminSession - GET // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onGet('api/apps/report/sessionin-admin/sessionin-admin') + .onGet('api/apps/report/admin-session/admin-session') .reply(({ request }) => { // Get the id from the params const id = request.params.get('id'); - // Clone the sessioninAdmins - const sessioninAdmins = cloneDeep(this._sessioninAdmins); + // Clone the adminSessions + const adminSessions = cloneDeep(this._adminSessions); - // Find the sessioninAdmin - const sessioninAdmin = sessioninAdmins.find( - (item: any) => item.id === id - ); + // Find the adminSession + const adminSession = adminSessions.find((item: any) => item.id === id); // Return the response - return [200, sessioninAdmin]; + return [200, adminSession]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninAdmin - POST + // @ AdminSession - POST // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onPost('api/apps/report/sessionin-admin/sessionin-admin') + .onPost('api/apps/report/admin-session/admin-session') .reply(() => { - // Generate a new sessioninAdmin - const newSessioninAdmin = { + // Generate a new adminSession + const newAdminSession = { id: FuseMockApiUtils.guid(), category: '', name: 'A New User', @@ -161,58 +159,58 @@ export class ReportSessioninAdminMockApi { active: false, }; - // Unshift the new sessioninAdmin - this._sessioninAdmins.unshift(newSessioninAdmin); + // Unshift the new adminSession + this._adminSessions.unshift(newAdminSession); // Return the response - return [200, newSessioninAdmin]; + return [200, newAdminSession]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninAdmin - PATCH + // @ AdminSession - PATCH // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onPatch('api/apps/report/sessionin-admin/sessionin-admin') + .onPatch('api/apps/report/admin-session/admin-session') .reply(({ request }) => { - // Get the id and sessioninAdmin + // Get the id and adminSession const id = request.body.id; - const sessioninAdmin = cloneDeep(request.body.sessioninAdmin); + const adminSession = cloneDeep(request.body.adminSession); - // Prepare the updated sessioninAdmin - let updatedSessioninAdmin = null; + // Prepare the updated adminSession + let updatedAdminSession = null; - // Find the sessioninAdmin and update it - this._sessioninAdmins.forEach((item, index, sessioninAdmins) => { + // Find the adminSession and update it + this._adminSessions.forEach((item, index, adminSessions) => { if (item.id === id) { - // Update the sessioninAdmin - sessioninAdmins[index] = assign( + // Update the adminSession + adminSessions[index] = assign( {}, - sessioninAdmins[index], - sessioninAdmin + adminSessions[index], + adminSession ); - // Store the updated sessioninAdmin - updatedSessioninAdmin = sessioninAdmins[index]; + // Store the updated adminSession + updatedAdminSession = adminSessions[index]; } }); // Return the response - return [200, updatedSessioninAdmin]; + return [200, updatedAdminSession]; }); // ----------------------------------------------------------------------------------------------------- - // @ SessioninAdmin - DELETE + // @ AdminSession - DELETE // ----------------------------------------------------------------------------------------------------- this._fuseMockApiService - .onDelete('api/apps/report/sessionin-admin/sessionin-admin') + .onDelete('api/apps/report/admin-session/admin-session') .reply(({ request }) => { // Get the id const id = request.params.get('id'); - // Find the sessioninAdmin and delete it - this._sessioninAdmins.forEach((item, index) => { + // Find the adminSession and delete it + this._adminSessions.forEach((item, index) => { if (item.id === id) { - this._sessioninAdmins.splice(index, 1); + this._adminSessions.splice(index, 1); } }); diff --git a/src/app/mock-api/apps/report/sessionin-admin/data.ts b/src/app/mock-api/apps/report/admin-session/data.ts similarity index 97% rename from src/app/mock-api/apps/report/sessionin-admin/data.ts rename to src/app/mock-api/apps/report/admin-session/data.ts index 28bd243..c8320da 100644 --- a/src/app/mock-api/apps/report/sessionin-admin/data.ts +++ b/src/app/mock-api/apps/report/admin-session/data.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -export const sessioninAdmins = [ +export const adminSessions = [ { id: '1', rank: '본사', diff --git a/src/app/mock-api/common/navigation/data.ts b/src/app/mock-api/common/navigation/data.ts index 4654cbc..1e4f359 100644 --- a/src/app/mock-api/common/navigation/data.ts +++ b/src/app/mock-api/common/navigation/data.ts @@ -329,11 +329,11 @@ export const defaultNavigation: FuseNavigationItem[] = [ link: '/report/sessionin-overlap', }, { - id: 'report.sessionin-admin', - title: 'Sessionin Admin', + id: 'report.admin-session', + title: 'Admin Session', type: 'basic', icon: 'heroicons_outline:academic-cap', - link: '/report/sessionin-admin', + link: '/report/admin-session', }, { id: 'report.excel-log', diff --git a/src/app/mock-api/index.ts b/src/app/mock-api/index.ts index 60ef8ad..ed07b09 100644 --- a/src/app/mock-api/index.ts +++ b/src/app/mock-api/index.ts @@ -60,7 +60,7 @@ import { ReportModificationLogMockApi } from './apps/report/modification-log/api import { ReportPaymentLogMockApi } from './apps/report/payment-log/api'; import { ReportSessioninInfoMockApi } from './apps/report/sessionin-info/api'; import { ReportSessioninOverlapMockApi } from './apps/report/sessionin-overlap/api'; -import { ReportSessioninAdminMockApi } from './apps/report/sessionin-admin/api'; +import { ReportAdminSessionMockApi } from './apps/report/admin-session/api'; import { ReportExcelLogMockApi } from './apps/report/excel-log/api'; import { ReportLoosingMockApi } from './apps/report/loosing/api'; import { BoardNoticeMockApi } from './apps/board/notice/api'; @@ -133,7 +133,7 @@ export const mockApiServices = [ ReportPaymentLogMockApi, ReportSessioninInfoMockApi, ReportSessioninOverlapMockApi, - ReportSessioninAdminMockApi, + ReportAdminSessionMockApi, ReportExcelLogMockApi, ReportLoosingMockApi, BoardNoticeMockApi, diff --git a/src/app/modules/admin/report/sessionin-admin/sessionin-admin.module.ts b/src/app/modules/admin/report/admin-session/admin-session.module.ts similarity index 91% rename from src/app/modules/admin/report/sessionin-admin/sessionin-admin.module.ts rename to src/app/modules/admin/report/admin-session/admin-session.module.ts index e22d1e3..b086e24 100644 --- a/src/app/modules/admin/report/sessionin-admin/sessionin-admin.module.ts +++ b/src/app/modules/admin/report/admin-session/admin-session.module.ts @@ -24,14 +24,14 @@ import { SharedModule } from 'app/shared/shared.module'; import { COMPONENTS } from './components'; -import { sessioninAdminRoutes } from './sessionin-admin.routing'; +import { adminSessionRoutes } from './admin-session.routing'; @NgModule({ declarations: [COMPONENTS], imports: [ TranslocoModule, SharedModule, - RouterModule.forChild(sessioninAdminRoutes), + RouterModule.forChild(adminSessionRoutes), MatButtonModule, MatFormFieldModule, @@ -51,4 +51,4 @@ import { sessioninAdminRoutes } from './sessionin-admin.routing'; MatMomentDateModule, ], }) -export class SessioninAdminModule {} +export class AdminSessionModule {} diff --git a/src/app/modules/admin/report/sessionin-admin/sessionin-admin.routing.ts b/src/app/modules/admin/report/admin-session/admin-session.routing.ts similarity index 71% rename from src/app/modules/admin/report/sessionin-admin/sessionin-admin.routing.ts rename to src/app/modules/admin/report/admin-session/admin-session.routing.ts index 493ade7..1ca274b 100644 --- a/src/app/modules/admin/report/sessionin-admin/sessionin-admin.routing.ts +++ b/src/app/modules/admin/report/admin-session/admin-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 { SessioninAdminsResolver } from './resolvers/sessionin-admin.resolver'; +import { AdminSessionsResolver } from './resolvers/admin-session.resolver'; import { UserResolver } from '../../member/user/resolvers/user.resolver'; -export const sessioninAdminRoutes: Route[] = [ +export const adminSessionRoutes: Route[] = [ { path: '', component: ListComponent, resolve: { - sessioninAdmins: SessioninAdminsResolver, + adminSessions: AdminSessionsResolver, }, }, { diff --git a/src/app/modules/admin/report/sessionin-admin/components/index.ts b/src/app/modules/admin/report/admin-session/components/index.ts similarity index 100% rename from src/app/modules/admin/report/sessionin-admin/components/index.ts rename to src/app/modules/admin/report/admin-session/components/index.ts diff --git a/src/app/modules/admin/report/sessionin-admin/components/list.component.html b/src/app/modules/admin/report/admin-session/components/list.component.html similarity index 96% rename from src/app/modules/admin/report/sessionin-admin/components/list.component.html rename to src/app/modules/admin/report/admin-session/components/list.component.html index 9e8098a..6eb58fd 100644 --- a/src/app/modules/admin/report/sessionin-admin/components/list.component.html +++ b/src/app/modules/admin/report/admin-session/components/list.component.html @@ -99,8 +99,8 @@
- - + +
- + - +
diff --git a/src/app/modules/admin/report/sessionin-admin/components/list.component.ts b/src/app/modules/admin/report/admin-session/components/list.component.ts similarity index 90% rename from src/app/modules/admin/report/sessionin-admin/components/list.component.ts rename to src/app/modules/admin/report/admin-session/components/list.component.ts index 36cdfa0..0c9a3d3 100644 --- a/src/app/modules/admin/report/sessionin-admin/components/list.component.ts +++ b/src/app/modules/admin/report/admin-session/components/list.component.ts @@ -24,13 +24,13 @@ import { import { fuseAnimations } from '@fuse/animations'; import { FuseConfirmationService } from '@fuse/services/confirmation'; -import { SessioninAdmin } from '../models/sessionin-admin'; -import { SessioninAdminPagination } from '../models/sessionin-admin-pagination'; -import { SessioninAdminService } from '../services/sessionin-admin.service'; +import { AdminSession } from '../models/admin-session'; +import { AdminSessionPagination } from '../models/admin-session-pagination'; +import { AdminSessionService } from '../services/admin-session.service'; import { Router } from '@angular/router'; @Component({ - selector: 'sessionin-admin-list', + selector: 'admin-session-list', templateUrl: './list.component.html', styles: [ /* language=SCSS */ @@ -60,12 +60,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild(MatPaginator) private _paginator!: MatPaginator; @ViewChild(MatSort) private _sort!: MatSort; - sessioninAdmins$!: Observable; + adminSessions$!: Observable; isLoading = false; searchInputControl = new FormControl(); - selectedSessioninAdmin?: SessioninAdmin; - pagination?: SessioninAdminPagination; + selectedAdminSession?: AdminSession; + pagination?: AdminSessionPagination; __isSearchOpened = false; ipBlockConfigForm!: FormGroup; @@ -80,7 +80,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { private _changeDetectorRef: ChangeDetectorRef, private _fuseConfirmationService: FuseConfirmationService, private _formBuilder: FormBuilder, - private _sessioninAdminService: SessioninAdminService, + private _adminSessionService: AdminSessionService, private router: Router ) {} @@ -93,9 +93,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { */ ngOnInit(): void { // Get the pagination - this._sessioninAdminService.pagination$ + this._adminSessionService.pagination$ .pipe(takeUntil(this._unsubscribeAll)) - .subscribe((pagination: SessioninAdminPagination | undefined) => { + .subscribe((pagination: AdminSessionPagination | undefined) => { // Update the pagination this.pagination = pagination; @@ -104,7 +104,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { }); // Get the products - this.sessioninAdmins$ = this._sessioninAdminService.sessioninAdmins$; + this.adminSessions$ = this._adminSessionService.adminSessions$; // Set ip, id block config this.__idBlockConfirmConfig(); diff --git a/src/app/modules/admin/report/sessionin-admin/models/sessionin-admin-pagination.ts b/src/app/modules/admin/report/admin-session/models/admin-session-pagination.ts similarity index 72% rename from src/app/modules/admin/report/sessionin-admin/models/sessionin-admin-pagination.ts rename to src/app/modules/admin/report/admin-session/models/admin-session-pagination.ts index 7503a10..9d13aaf 100644 --- a/src/app/modules/admin/report/sessionin-admin/models/sessionin-admin-pagination.ts +++ b/src/app/modules/admin/report/admin-session/models/admin-session-pagination.ts @@ -1,4 +1,4 @@ -export interface SessioninAdminPagination { +export interface AdminSessionPagination { length: number; size: number; page: number; diff --git a/src/app/modules/admin/report/sessionin-admin/models/sessionin-admin.ts b/src/app/modules/admin/report/admin-session/models/admin-session.ts similarity index 86% rename from src/app/modules/admin/report/sessionin-admin/models/sessionin-admin.ts rename to src/app/modules/admin/report/admin-session/models/admin-session.ts index 66bf73f..38f48af 100644 --- a/src/app/modules/admin/report/sessionin-admin/models/sessionin-admin.ts +++ b/src/app/modules/admin/report/admin-session/models/admin-session.ts @@ -1,4 +1,4 @@ -export interface SessioninAdmin { +export interface AdminSession { id: string; rank?: string; userId?: string; diff --git a/src/app/modules/admin/report/sessionin-admin/resolvers/sessionin-admin.resolver.ts b/src/app/modules/admin/report/admin-session/resolvers/admin-session.resolver.ts similarity index 68% rename from src/app/modules/admin/report/sessionin-admin/resolvers/sessionin-admin.resolver.ts rename to src/app/modules/admin/report/admin-session/resolvers/admin-session.resolver.ts index c089aa9..db6fa6a 100644 --- a/src/app/modules/admin/report/sessionin-admin/resolvers/sessionin-admin.resolver.ts +++ b/src/app/modules/admin/report/admin-session/resolvers/admin-session.resolver.ts @@ -7,19 +7,19 @@ import { } from '@angular/router'; import { catchError, Observable, throwError } from 'rxjs'; -import { SessioninAdmin } from '../models/sessionin-admin'; -import { SessioninAdminPagination } from '../models/sessionin-admin-pagination'; -import { SessioninAdminService } from '../services/sessionin-admin.service'; +import { AdminSession } from '../models/admin-session'; +import { AdminSessionPagination } from '../models/admin-session-pagination'; +import { AdminSessionService } from '../services/admin-session.service'; @Injectable({ providedIn: 'root', }) -export class SessioninAdminResolver implements Resolve { +export class AdminSessionResolver implements Resolve { /** * Constructor */ constructor( - private _sessioninAdminService: SessioninAdminService, + private _adminSessionService: AdminSessionService, private _router: Router ) {} @@ -36,9 +36,9 @@ export class SessioninAdminResolver implements Resolve { resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot - ): Observable { - return this._sessioninAdminService - .getSessioninAdminById(route.paramMap.get('id')) + ): Observable { + return this._adminSessionService + .getAdminSessionById(route.paramMap.get('id')) .pipe( // Error here means the requested product is not available catchError((error) => { @@ -61,11 +61,11 @@ export class SessioninAdminResolver implements Resolve { @Injectable({ providedIn: 'root', }) -export class SessioninAdminsResolver implements Resolve { +export class AdminSessionsResolver implements Resolve { /** * Constructor */ - constructor(private _sessioninAdminService: SessioninAdminService) {} + constructor(private _adminSessionService: AdminSessionService) {} // ----------------------------------------------------------------------------------------------------- // @ Public methods @@ -81,9 +81,9 @@ export class SessioninAdminsResolver implements Resolve { route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable<{ - pagination: SessioninAdminPagination; - sessioninAdmins: SessioninAdmin[]; + pagination: AdminSessionPagination; + adminSessions: AdminSession[]; }> { - return this._sessioninAdminService.getSessioninAdmins(); + return this._adminSessionService.getAdminSessions(); } } diff --git a/src/app/modules/admin/report/sessionin-admin/services/sessionin-admin.service.ts b/src/app/modules/admin/report/admin-session/services/admin-session.service.ts similarity index 52% rename from src/app/modules/admin/report/sessionin-admin/services/sessionin-admin.service.ts rename to src/app/modules/admin/report/admin-session/services/admin-session.service.ts index bf25057..b98e563 100644 --- a/src/app/modules/admin/report/sessionin-admin/services/sessionin-admin.service.ts +++ b/src/app/modules/admin/report/admin-session/services/admin-session.service.ts @@ -12,21 +12,21 @@ import { throwError, } from 'rxjs'; -import { SessioninAdmin } from '../models/sessionin-admin'; -import { SessioninAdminPagination } from '../models/sessionin-admin-pagination'; +import { AdminSession } from '../models/admin-session'; +import { AdminSessionPagination } from '../models/admin-session-pagination'; @Injectable({ providedIn: 'root', }) -export class SessioninAdminService { +export class AdminSessionService { // Private private __pagination = new BehaviorSubject< - SessioninAdminPagination | undefined + AdminSessionPagination | undefined >(undefined); - private __sessioninAdmin = new BehaviorSubject( + private __adminSession = new BehaviorSubject( undefined ); - private __sessioninAdmins = new BehaviorSubject( + private __adminSessions = new BehaviorSubject( undefined ); @@ -42,22 +42,22 @@ export class SessioninAdminService { /** * Getter for pagination */ - get pagination$(): Observable { + get pagination$(): Observable { return this.__pagination.asObservable(); } /** - * Getter for sessioninAdmin + * Getter for adminSession */ - get sessioninAdmin$(): Observable { - return this.__sessioninAdmin.asObservable(); + get adminSession$(): Observable { + return this.__adminSession.asObservable(); } /** - * Getter for sessioninAdmins + * Getter for adminSessions */ - get sessioninAdmins$(): Observable { - return this.__sessioninAdmins.asObservable(); + get adminSessions$(): Observable { + return this.__adminSessions.asObservable(); } // ----------------------------------------------------------------------------------------------------- @@ -65,7 +65,7 @@ export class SessioninAdminService { // ----------------------------------------------------------------------------------------------------- /** - * Get SessioninAdmins + * Get AdminSessions * * * @param page @@ -74,21 +74,21 @@ export class SessioninAdminService { * @param order * @param search */ - getSessioninAdmins( + getAdminSessions( page: number = 0, size: number = 10, sort: string = 'name', order: 'asc' | 'desc' | '' = 'asc', search: string = '' ): Observable<{ - pagination: SessioninAdminPagination; - sessioninAdmins: SessioninAdmin[]; + pagination: AdminSessionPagination; + adminSessions: AdminSession[]; }> { return this._httpClient .get<{ - pagination: SessioninAdminPagination; - sessioninAdmins: SessioninAdmin[]; - }>('api/apps/report/sessionin-admin/sessionin-admins', { + pagination: AdminSessionPagination; + adminSessions: AdminSession[]; + }>('api/apps/report/admin-session/admin-sessions', { params: { page: '' + page, size: '' + size, @@ -100,7 +100,7 @@ export class SessioninAdminService { .pipe( tap((response) => { this.__pagination.next(response.pagination); - this.__sessioninAdmins.next(response.sessioninAdmins); + this.__adminSessions.next(response.adminSessions); }) ); } @@ -108,19 +108,19 @@ export class SessioninAdminService { /** * Get product by id */ - getSessioninAdminById(id: string | null): Observable { - return this.__sessioninAdmins.pipe( + getAdminSessionById(id: string | null): Observable { + return this.__adminSessions.pipe( take(1), - map((sessioninAdmins) => { + map((adminSessions) => { // Find the product - const sessioninAdmin = - sessioninAdmins?.find((item) => item.id === id) || undefined; + const adminSession = + adminSessions?.find((item) => item.id === id) || undefined; // Update the product - this.__sessioninAdmin.next(sessioninAdmin); + this.__adminSession.next(adminSession); // Return the product - return sessioninAdmin; + return adminSession; }), switchMap((product) => { if (!product) { @@ -135,24 +135,21 @@ export class SessioninAdminService { /** * Create product */ - createSessioninAdmin(): Observable { - return this.sessioninAdmins$.pipe( + createAdminSession(): Observable { + return this.adminSessions$.pipe( take(1), - switchMap((sessioninAdmins) => + switchMap((adminSessions) => this._httpClient - .post('api/apps/report/sessionin-admin/product', {}) + .post('api/apps/report/admin-session/product', {}) .pipe( - map((newSessioninAdmin) => { - // Update the sessioninAdmins with the new product - if (!!sessioninAdmins) { - this.__sessioninAdmins.next([ - newSessioninAdmin, - ...sessioninAdmins, - ]); + map((newAdminSession) => { + // Update the adminSessions with the new product + if (!!adminSessions) { + this.__adminSessions.next([newAdminSession, ...adminSessions]); } // Return the new product - return newSessioninAdmin; + return newAdminSession; }) ) ) diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 1f9ef4e..6a972b7 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -38,7 +38,7 @@ "Modification Log": "Member Modification Logs", "Payment Log": "Manual Payment Logs", "Sessionin Info": "Sessionin Info", - "Sessionin Admin": "Sessionin Admin Info", + "Admin Session": "Admin Session", "Sessionin Overlap": "Sessionin Overlap", "Excel Log": "Excel Download Logs", "Loosing": "Loosing Management", diff --git a/src/assets/i18n/ko.json b/src/assets/i18n/ko.json index 1d51cb1..d378d95 100644 --- a/src/assets/i18n/ko.json +++ b/src/assets/i18n/ko.json @@ -47,7 +47,7 @@ "Payment Log": "수동지급/회수 로그", "Sessionin Info": "로그인정보", "Sessionin Overlap": "중복로그인", - "Sessionin Admin": "관리자 로그인정보", + "Admin Session": "관리자 로그인정보", "Excel Log": "엑셀다운 로그", "Loosing": "루징관리", "Notice": "공지사항",