From 2a4e370f8c072b4f453b7e99ae79a508ff0c4796 Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 8 Mar 2018 14:39:07 +0900 Subject: [PATCH] added infra store --- src/app/commons/model/Page.ts | 13 ++++++++ src/app/commons/model/PageParams.ts | 8 +++++ src/app/commons/model/index.ts | 2 ++ src/packages/infra/infra-store.module.ts | 0 src/packages/infra/infra.constant.ts | 0 .../infra/service/infra.service.spec.ts | 0 src/packages/infra/service/infra.service.ts | 32 +++++++++++++++++++ src/packages/infra/store/index.ts | 0 .../infra/store/readbydomain/index.ts | 4 +++ .../store/readbydomain/readbydomain.action.ts | 0 .../readbydomain/readbydomain.effect.spec.ts | 0 .../store/readbydomain/readbydomain.effect.ts | 0 .../readbydomain/readbydomain.reducer.ts | 0 .../store/readbydomain/readbydomain.state.ts | 20 ++++++++++++ 14 files changed, 79 insertions(+) create mode 100644 src/app/commons/model/Page.ts create mode 100644 src/app/commons/model/PageParams.ts create mode 100644 src/app/commons/model/index.ts create mode 100644 src/packages/infra/infra-store.module.ts create mode 100644 src/packages/infra/infra.constant.ts create mode 100644 src/packages/infra/service/infra.service.spec.ts create mode 100644 src/packages/infra/service/infra.service.ts create mode 100644 src/packages/infra/store/index.ts create mode 100644 src/packages/infra/store/readbydomain/index.ts create mode 100644 src/packages/infra/store/readbydomain/readbydomain.action.ts create mode 100644 src/packages/infra/store/readbydomain/readbydomain.effect.spec.ts create mode 100644 src/packages/infra/store/readbydomain/readbydomain.effect.ts create mode 100644 src/packages/infra/store/readbydomain/readbydomain.reducer.ts create mode 100644 src/packages/infra/store/readbydomain/readbydomain.state.ts diff --git a/src/app/commons/model/Page.ts b/src/app/commons/model/Page.ts new file mode 100644 index 0000000..e64070a --- /dev/null +++ b/src/app/commons/model/Page.ts @@ -0,0 +1,13 @@ +export interface Page { + content: any; + first: boolean; + last: boolean; + number: number; + numberOfElements: number; + size: number; + sort: any; + totalElements: number; + totalPages: number; +} + +// export default Page; diff --git a/src/app/commons/model/PageParams.ts b/src/app/commons/model/PageParams.ts new file mode 100644 index 0000000..1ab0d14 --- /dev/null +++ b/src/app/commons/model/PageParams.ts @@ -0,0 +1,8 @@ +export interface PageParams { + pageNo: string; + countPerPage: string; + sortCol?: string; + sortDirection?: string; +} + +// export default PageParams; diff --git a/src/app/commons/model/index.ts b/src/app/commons/model/index.ts new file mode 100644 index 0000000..46f7171 --- /dev/null +++ b/src/app/commons/model/index.ts @@ -0,0 +1,2 @@ +export * from './Page'; +export * from './PageParams'; diff --git a/src/packages/infra/infra-store.module.ts b/src/packages/infra/infra-store.module.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/infra.constant.ts b/src/packages/infra/infra.constant.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/service/infra.service.spec.ts b/src/packages/infra/service/infra.service.spec.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/service/infra.service.ts b/src/packages/infra/service/infra.service.ts new file mode 100644 index 0000000..feddf80 --- /dev/null +++ b/src/packages/infra/service/infra.service.ts @@ -0,0 +1,32 @@ +// import { Injectable } from '@angular/core'; +// import { Observable } from 'rxjs/Observable'; + +// import 'rxjs/add/operator/map'; + +// import { RESTService } from 'packages/commons/service/rest.service'; +// import { DomainMember } from 'packages/domain/model'; + +// import { Infra } from '../model'; + +// @Injectable() +// export class MemberService { + +// public constructor( +// private restService: RESTService, +// ) { + +// } + +// public signin(email: string, password: string): Observable { +// const body = { +// signinId: email, +// signinPw: password, +// }; + +// return this.restService.post('/account/signin', body); +// } + +// public signup(member: Member): Observable { +// return this.restService.post('/account/signup', member); +// } +// } diff --git a/src/packages/infra/store/index.ts b/src/packages/infra/store/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/store/readbydomain/index.ts b/src/packages/infra/store/readbydomain/index.ts new file mode 100644 index 0000000..aee2667 --- /dev/null +++ b/src/packages/infra/store/readbydomain/index.ts @@ -0,0 +1,4 @@ +// export * from './readbydomain.action'; +// export * from './readbydomain.effect'; +// export * from './readbydomain.reducer'; +// export * from './readbydomain.state'; diff --git a/src/packages/infra/store/readbydomain/readbydomain.action.ts b/src/packages/infra/store/readbydomain/readbydomain.action.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/store/readbydomain/readbydomain.effect.spec.ts b/src/packages/infra/store/readbydomain/readbydomain.effect.spec.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/store/readbydomain/readbydomain.effect.ts b/src/packages/infra/store/readbydomain/readbydomain.effect.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/store/readbydomain/readbydomain.reducer.ts b/src/packages/infra/store/readbydomain/readbydomain.reducer.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/infra/store/readbydomain/readbydomain.state.ts b/src/packages/infra/store/readbydomain/readbydomain.state.ts new file mode 100644 index 0000000..00c4c33 --- /dev/null +++ b/src/packages/infra/store/readbydomain/readbydomain.state.ts @@ -0,0 +1,20 @@ +import { ErrorResponse } from 'packages/commons/service/error-response'; + +import { Infra } from '../../model'; +import { Page } from '../../../../app/commons/model'; + +export interface State { + error: ErrorResponse | null; + isPending: boolean; + infraList: Infra[] | null; +} + +export const initialState: State = { + error: null, + isPending: false, + infraList: null, +}; + +export const getInfraList = (state: State) => state.infraList; +export const getError = (state: State) => state.error; +export const isPending = (state: State) => state.isPending;