added noauthprobe

This commit is contained in:
snoop 2017-07-04 17:22:11 +09:00
parent 2a8f29d994
commit 218ef7cf98
21 changed files with 272 additions and 22 deletions

View File

@ -8,18 +8,18 @@ export class NoAuthProbeService extends Service {
super('NoAuthProbeService');
}
public regist(noAuthProbe:NoAuthProbe): void {
public regist(noAuthProbe: NoAuthProbe): void {
return null;
}
// Todo List<NoAuthProbe>
public readAllBySensor(domain:Domain): Promise<NoAuthProbe> {
public readAllByDomain(domain: Domain): Promise<NoAuthProbe> {
return null;
}
public read(id:string): Promise<NoAuthProbe> {
public read(id: number): Promise<NoAuthProbe> {
return null;
}
}
export default NoAuthProbeService;
export default NoAuthProbeService;

View File

@ -1,3 +1,43 @@
/**
* Created by geek on 17. 7. 3.
*/
import Action from '@overflow/commons/redux/Action';
import NoAuthProbe from '../..//api/model/NoAuthProbe';
import ReadPayload from '../payload/ReadPayload';
// Action Type
export type REQUEST = '@overflow/noAuthProbe/read/REQUEST';
export type REQUEST_SUCCESS = '@overflow/noAuthProbe/read/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/noAuthProbe/read/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/noAuthProbe/read/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/noAuthProbe/read/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/noAuthProbe/read/REQUEST_FAILURE';
// Action Creater
export type request = (id: number) => Action<ReadPayload>;
export type requestSuccess = (noAuthProbe: NoAuthProbe) => Action<NoAuthProbe>;
export type requestFailure = (error: Error) => Action;
export const request: request = (id: number): Action<ReadPayload> => {
return {
type: REQUEST,
payload: {
id:id,
},
};
};
export const requestSuccess: requestSuccess = (noAuthProbe: NoAuthProbe): Action<NoAuthProbe> => {
return {
type: REQUEST_SUCCESS,
payload: noAuthProbe,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,44 @@
import Action from '@overflow/commons/redux/Action';
import NoAuthProbe from '../../api/model/NoAuthProbe';
import Domain from '@overflow/domain/api/model/Domain';
import ReadAllByDomainPayload from '../payload/ReadAllByDomainPayload';
// Action Type
export type REQUEST = '@overflow/noAuthProbe/readAllByDomain/REQUEST';
export type REQUEST_SUCCESS = '@overflow/noAuthProbe/readAllByDomain/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/noAuthProbe/readAllByDomain/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/noAuthProbe/readAllByDomain/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/noAuthProbe/readAllByDomain/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/noAuthProbe/readAllByDomain/REQUEST_FAILURE';
// Action Creater
export type request = (domain: Domain) => Action<ReadAllByDomainPayload>;
export type requestSuccess = (noAuthProbe: NoAuthProbe) => Action<NoAuthProbe>;
export type requestFailure = (error: Error) => Action;
export const request: request = (domain: Domain): Action<ReadAllByDomainPayload> => {
return {
type: REQUEST,
payload: {
domain:domain,
},
};
};
export const requestSuccess: requestSuccess = (noAuthProbe: NoAuthProbe): Action<NoAuthProbe> => {
return {
type: REQUEST_SUCCESS,
payload: noAuthProbe,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,43 @@
import Action from '@overflow/commons/redux/Action';
import NoAuthProbe from '../..//api/model/NoAuthProbe';
import RegistPayload from '../payload/RegistPayload';
// Action Type
export type REQUEST = '@overflow/noAuthProbe/regist/REQUEST';
export type REQUEST_SUCCESS = '@overflow/noAuthProbe/regist/REQUEST_SUCCESS';
export type REQUEST_FAILURE = '@overflow/noAuthProbe/regist/REQUEST_FAILURE';
export const REQUEST: REQUEST = '@overflow/noAuthProbe/regist/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/noAuthProbe/regist/REQUEST_SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/noAuthProbe/regist/REQUEST_FAILURE';
// Action Creater
export type request = (noAuthProbe: NoAuthProbe) => Action<RegistPayload>;
export type requestSuccess = (noAuthProbe: NoAuthProbe) => Action<NoAuthProbe>;
export type requestFailure = (error: Error) => Action;
export const request: request = (noAuthProbe: NoAuthProbe): Action<RegistPayload> => {
return {
type: REQUEST,
payload: {
noAuthProbe:noAuthProbe,
},
};
};
export const requestSuccess: requestSuccess = (noAuthProbe: NoAuthProbe): Action<NoAuthProbe> => {
return {
type: REQUEST_SUCCESS,
payload: noAuthProbe,
};
};
export const requestFailure: requestFailure = (error: Error): Action => {
return {
type: REQUEST_FAILURE,
error: error,
};
};

View File

@ -0,0 +1,7 @@
import Domain from '@overflow/domain/api/model/Domain';
interface ReadAllByDomainPayload {
domain: Domain;
}
export default ReadAllByDomainPayload;

View File

@ -1,3 +0,0 @@
/**
* Created by geek on 17. 7. 3.
*/

View File

@ -0,0 +1,7 @@
interface ReadPayload {
id: number;
}
export default ReadPayload;

View File

@ -1,3 +1,7 @@
/**
* Created by geek on 17. 7. 3.
*/
import NoAuthProbe from '../../api/model/NoAuthProbe';
interface RegistPayload {
noAuthProbe: NoAuthProbe;
}
export default RegistPayload;

View File

@ -1,3 +0,0 @@
/**
* Created by geek on 17. 7. 3.
*/

View File

@ -1,3 +1,39 @@
/**
* Created by geek on 17. 7. 3.
*/
import { SagaIterator } from 'redux-saga';
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
import AppContext from '@overflow/commons/context';
import Action from '@overflow/commons/redux/Action';
import NoAuthProbe from '../../api/model/NoAuthProbe';
import NoAuthProbeService from '../../api/service/NoAuthProbeService';
import * as ReadActions from '../action/read';
import ReadPayload from '../payload/ReadPayload';
function* read(action: Action<ReadPayload>): SagaIterator {
try {
const {id} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<NoAuthProbeService>().read, id);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(ReadActions.requestSuccess(retApikey));
} catch (e) {
yield put(ReadActions.requestFailure(e));
} finally {
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: false},
// });
}
}
export function* watchRead(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, read);
}

View File

@ -0,0 +1,39 @@
import { SagaIterator } from 'redux-saga';
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
import AppContext from '@overflow/commons/context';
import Action from '@overflow/commons/redux/Action';
import NoAuthProbe from '../../api/model/NoAuthProbe';
import NoAuthProbeService from '../../api/service/NoAuthProbeService';
import * as ReadActions from '../action/read_all_by_domain';
import ReadAllByDomainPayload from '../payload/ReadAllByDomainPayload';
function* readAllByDomain(action: Action<ReadAllByDomainPayload>): SagaIterator {
try {
const {domain} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<NoAuthProbeService>().readAllByDomain, domain);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(ReadActions.requestSuccess(retApikey));
} catch (e) {
yield put(ReadActions.requestFailure(e));
} finally {
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: false},
// });
}
}
export function* watchReadAllByDomain(): SagaIterator {
yield takeLatest(ReadActions.REQUEST, readAllByDomain);
}

View File

@ -1,3 +0,0 @@
/**
* Created by geek on 17. 7. 3.
*/

View File

@ -0,0 +1,39 @@
import { SagaIterator } from 'redux-saga';
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
import AppContext from '@overflow/commons/context';
import Action from '@overflow/commons/redux/Action';
import NoAuthProbe from '../../api/model/NoAuthProbe';
import NoAuthProbeService from '../../api/service/NoAuthProbeService';
import * as RegistActions from '../action/regist';
import RegistPayload from '../payload/RegistPayload';
function* regist(action: Action<RegistPayload>): SagaIterator {
try {
const {noAuthProbe} = action.payload;
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: true},
// });
const retApikey = yield call(AppContext.getService<NoAuthProbeService>().regist, noAuthProbe);
// if (responseBody.token === undefined) {
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
// }
yield put(RegistActions.requestSuccess(retApikey));
} catch (e) {
yield put(RegistActions.requestFailure(e));
} finally {
// yield put({
// type: types.SENDING_REQUEST,
// payload: {sendingRequest: false},
// });
}
}
export function* watchRegist(): SagaIterator {
yield takeLatest(RegistActions.REQUEST, regist);
}