import { AccountDto } from "../DTO/account-dto.model"; import { Account } from "../model/account.model"; import { AccountSearchParam } from "../search/account-search-param.model"; import { ResetPassDto } from "../DTO/reset-pass-dto.model"; import { HostConfig } from '../config/host.config'; import { Injectable } from '@angular/core'; import { HttpHandler } from './http-handler.service'; import { Page } from '../response/page.type'; @Injectable({ providedIn: 'root', }) export class AccountService { static PATH = '/account'; constructor(private httpHandler: HttpHandler) {} createAccount(account: AccountDto, header?: any): Promise { return this.httpHandler.post(`${HostConfig.DEV_HOST}${AccountService.PATH}/create` ,account, header); } updateAccount(account: Account, header?: any): Promise { return this.httpHandler.post(`${HostConfig.DEV_HOST}${AccountService.PATH}/update` ,account, header); } searchAccount(accountSearchParam: AccountSearchParam,page: number,size: number, header?: any): Promise> { return this.httpHandler.post>(`${HostConfig.DEV_HOST}${AccountService.PATH}/search?page=${page}&size=${size}` ,accountSearchParam, header); } searchAccountDTO(accountSearchParam: AccountSearchParam,page: number,size: number, header?: any): Promise> { return this.httpHandler.post>(`${HostConfig.DEV_HOST}${AccountService.PATH}/searchDTO?page=${page}&size=${size}` ,accountSearchParam, header); } delete(accountSearchParam: AccountSearchParam, header?: any): Promise { return this.httpHandler.post(`${HostConfig.DEV_HOST}${AccountService.PATH}/delete` ,accountSearchParam, header); } login(form: LoginForm, header?: any): Promise { return this.httpHandler.post(`${HostConfig.DEV_HOST}${AccountService.PATH}/login` ,form, header); } logout(httpServletRequest: HttpServletRequest, header?: any): Promise { return this.httpHandler.get(`${HostConfig.DEV_HOST}${AccountService.PATH}/logout`, header); } getById(id: number, header?: any): Promise { return this.httpHandler.get(`${HostConfig.DEV_HOST}${AccountService.PATH}/getById?id=${id}`, header); } getByToken(httpServletRequest: HttpServletRequest, header?: any): Promise { return this.httpHandler.get(`${HostConfig.DEV_HOST}${AccountService.PATH}/getByToken`, header); } geLoginInfoByPhone(phone: string,security: string, header?: any): Promise { return this.httpHandler.get(`${HostConfig.DEV_HOST}${AccountService.PATH}/geLoginInfoByPhone?phone=${phone}&security=${security}`, header); } getByPhone(phone: string, header?: any): Promise { return this.httpHandler.get(`${HostConfig.DEV_HOST}${AccountService.PATH}/getByPhone?phone=${phone}`, header); } getSmsCodeForLogIn(phone: string,type: string, header?: any): Promise { return this.httpHandler.get(`${HostConfig.DEV_HOST}${AccountService.PATH}/getSmsCode?phone=${phone}&type=${type}`, header); } resetPass(resetPass: ResetPassDto, header?: any): Promise { return this.httpHandler.post(`${HostConfig.DEV_HOST}${AccountService.PATH}/resetPass` ,resetPass, header); } }