sensor/sensorItem
This commit is contained in:
		
							parent
							
								
									2a8f29d994
								
							
						
					
					
						commit
						1a249ba767
					
				@ -12,8 +12,7 @@ export class SensorItemService extends Service {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Todo List<SensorItem>
 | 
			
		||||
  public readAllBySensor(sensor:Sensor): Promise<SensorItem> {
 | 
			
		||||
  public readAllBySensor(sensor:Sensor): Promise<SensorItem[]> {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,8 +13,7 @@ export class SensorService extends Service {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Todo List<Sensor>
 | 
			
		||||
  public readAllByTarget(target:Target): Promise<Sensor> {
 | 
			
		||||
  public readAllByTarget(target:Target): Promise<Sensor[]> {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import ItemReadPayload from '../payload/ItemReadPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor_item/read/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor_item/read/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor_item/read/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor_item/read/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/read/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/read/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (id: string) => Action<ItemReadPayload>;
 | 
			
		||||
export type requestSuccess = (sensorItem: SensorItem) => Action<SensorItem>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (id: string): Action<ItemReadPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      id: id,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensorItem: SensorItem): Action<SensorItem> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensorItem,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,43 @@
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
import ItemReadAllBySensorPayload from '../payload/ItemReadAllBySensorPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/item_read_all_by_sensor/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (sensor: Sensor) => Action<ItemReadAllBySensorPayload>;
 | 
			
		||||
export type requestSuccess = (sensorItems: SensorItem[]) => Action<SensorItem[]>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (sensor: Sensor): Action<ItemReadAllBySensorPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      sensor: sensor,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensorItems: SensorItem[]): Action<SensorItem[]> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensorItems,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
@ -1,3 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import ItemRegistPayload from '../payload/ItemRegistPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor_item/regist/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor_item/regist/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor_item/regist/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor_item/regist/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/regist/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/regist/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (sensorItem: SensorItem) => Action<ItemRegistPayload>;
 | 
			
		||||
export type requestSuccess = (sensorItem: SensorItem) => Action<SensorItem>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (sensorItem: SensorItem): Action<ItemRegistPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      sensorItem: sensorItem,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensorItem: SensorItem): Action<SensorItem> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensorItem,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,41 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import ItemRemovePayload from '../payload/ItemRemovePayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor_item/remove/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor_item/remove/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor_item/remove/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor_item/remove/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor_item/remove/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor_item/remove/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (sensorItem: SensorItem) => Action<ItemRemovePayload>;
 | 
			
		||||
export type requestSuccess = () => Action<void>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (sensorItem: SensorItem): Action<ItemRemovePayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      sensorItem: sensorItem,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (): Action<void> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
import ReadPayload from '../payload/ReadPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor/read/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor/read/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor/read/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor/read/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (id: string) => Action<ReadPayload>;
 | 
			
		||||
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (id: string): Action<ReadPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      id: id,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensor,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										43
									
								
								src/ts/@overflow/sensor/redux/action/read_all_by_target.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/ts/@overflow/sensor/redux/action/read_all_by_target.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,43 @@
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
import ReadAllByTargetPayload from '../payload/ReadAllByTargetPayload';
 | 
			
		||||
import Target from '@overflow/target/api/model/Target';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor/read_all_by_target/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor/read_all_by_target/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor/read_all_by_target/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor/read_all_by_target/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read_all_by_target/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read_all_by_target/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (target: Target) => Action<ReadAllByTargetPayload>;
 | 
			
		||||
export type requestSuccess = (sensors: Sensor[]) => Action<Sensor[]>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (target: Target): Action<ReadAllByTargetPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      target: target,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensors: Sensor[]): Action<Sensor[]> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensors,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
@ -0,0 +1,42 @@
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
import RegistPayload from '../payload/RegistPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor/regist/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor/regist/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor/regist/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor/regist/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/regist/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/regist/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (sensor: Sensor) => Action<RegistPayload>;
 | 
			
		||||
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (sensor: Sensor): Action<RegistPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      sensor: sensor,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensor,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
@ -1,3 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
import RemovePayload from '../payload/RemovePayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor/remove/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor/remove/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor/remove/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor/remove/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/remove/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/remove/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (sensor: Sensor) => Action<RemovePayload>;
 | 
			
		||||
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (sensor: Sensor): Action<RemovePayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      sensor: sensor,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensor,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
import StartPayload from '../payload/StartPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor/start/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor/start/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor/start/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor/start/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/start/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/start/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (sensor: Sensor) => Action<StartPayload>;
 | 
			
		||||
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (sensor: Sensor): Action<StartPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      sensor: sensor,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensor,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,42 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
import StopPayload from '../payload/StopPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/sensor/stop/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/sensor/stop/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/sensor/stop/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/sensor/stop/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/stop/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/stop/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (sensor: Sensor) => Action<StopPayload>;
 | 
			
		||||
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (sensor: Sensor): Action<StopPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST,
 | 
			
		||||
    payload: {
 | 
			
		||||
      sensor: sensor,
 | 
			
		||||
    },
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (sensor: Sensor): Action<Sensor> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: sensor,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_FAILURE,
 | 
			
		||||
    error: error,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,7 @@
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
 | 
			
		||||
interface ItemReadAllBySensorPayload {
 | 
			
		||||
    sensor: Sensor;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ItemReadAllBySensorPayload;
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
@ -1,3 +1,5 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
interface ItemReadPayload {
 | 
			
		||||
    id: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ItemReadPayload;
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
 | 
			
		||||
interface ItemRegistPayload {
 | 
			
		||||
    sensorItem: SensorItem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ItemRegistPayload;
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
 | 
			
		||||
interface ItemRemovePayload {
 | 
			
		||||
    sensorItem: SensorItem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ItemRemovePayload;
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,7 @@
 | 
			
		||||
import Target from '@overflow/target/api/model/Target';
 | 
			
		||||
 | 
			
		||||
interface ReadAllByTargetPayload {
 | 
			
		||||
    target: Target;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ReadAllByTargetPayload;
 | 
			
		||||
@ -1,3 +1,5 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
interface ReadPayload {
 | 
			
		||||
    id: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default ReadPayload;
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
 | 
			
		||||
interface RegistPayload {
 | 
			
		||||
    sensor: Sensor;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default RegistPayload;
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
 | 
			
		||||
interface RemovePayload {
 | 
			
		||||
    sensor: Sensor;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default RemovePayload;
 | 
			
		||||
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
							
								
								
									
										7
									
								
								src/ts/@overflow/sensor/redux/payload/StartPayload.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/ts/@overflow/sensor/redux/payload/StartPayload.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
 | 
			
		||||
interface StartPayload {
 | 
			
		||||
    sensor: Sensor;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default StartPayload;
 | 
			
		||||
@ -1,3 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Sensor from '../../api/model/Sensor';
 | 
			
		||||
 | 
			
		||||
interface StopPayload {
 | 
			
		||||
    sensor: Sensor;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default StopPayload;
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import SensorItemService from '../../api/service/SensorItemService';
 | 
			
		||||
import * as ItemReadActions from '../action/item_read';
 | 
			
		||||
import ItemReadPayload from '../payload/ItemReadPayload';
 | 
			
		||||
 | 
			
		||||
function* readItem(action: Action<ItemReadPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {id} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorItemService>().read, id);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(ItemReadActions.requestSuccess(retSensor));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(ItemReadActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchReadItem(): SagaIterator {
 | 
			
		||||
  yield takeLatest(ItemReadActions.REQUEST, readItem);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import SensorItemService from '../../api/service/SensorItemService';
 | 
			
		||||
import * as ItemReadAllBySensorActions from '../action/item_read_all_by_sensor';
 | 
			
		||||
import ItemReadAllBySensorActionsPayload from '../payload/ItemReadAllBySensorPayload';
 | 
			
		||||
 | 
			
		||||
function* readAllItemBySensor(action: Action<ItemReadAllBySensorActionsPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {sensor} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorItemService>().readAllBySensor, sensor);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(ItemReadAllBySensorActions.requestSuccess(retSensor));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(ItemReadAllBySensorActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchReadAllItemBySensor(): SagaIterator {
 | 
			
		||||
  yield takeLatest(ItemReadAllBySensorActions.REQUEST, readAllItemBySensor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import SensorItemService from '../../api/service/SensorItemService';
 | 
			
		||||
import * as ItemRegistActions from '../action/item_regist';
 | 
			
		||||
import ItemRegistPayload from '../payload/ItemRegistPayload';
 | 
			
		||||
 | 
			
		||||
function* registItem(action: Action<ItemRegistPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {sensorItem} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorItemService>().regist, sensorItem);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(ItemRegistActions.requestSuccess(retSensor));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(ItemRegistActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchRegistItem(): SagaIterator {
 | 
			
		||||
  yield takeLatest(ItemRegistActions.REQUEST, registItem);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 SensorItem from '../../api/model/SensorItem';
 | 
			
		||||
import SensorItemService from '../../api/service/SensorItemService';
 | 
			
		||||
import * as ItemRemoveActions from '../action/item_remove';
 | 
			
		||||
import ItemRemovePayload from '../payload/ItemRemovePayload';
 | 
			
		||||
 | 
			
		||||
function* removeItem(action: Action<ItemRemovePayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {sensorItem} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    yield call(AppContext.getService<SensorItemService>().remove, sensorItem);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(ItemRemoveActions.requestSuccess());
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(ItemRemoveActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchRemoveItem(): SagaIterator {
 | 
			
		||||
  yield takeLatest(ItemRemoveActions.REQUEST, removeItem);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 Sensor from '../../api/model/Sensor';
 | 
			
		||||
import SensorService from '../../api/service/SensorService';
 | 
			
		||||
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 retSensor = yield call(AppContext.getService<SensorService>().read, id);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(ReadActions.requestSuccess(retSensor));
 | 
			
		||||
  } 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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										38
									
								
								src/ts/@overflow/sensor/redux/saga/read_all_by_target.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/ts/@overflow/sensor/redux/saga/read_all_by_target.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
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 Sensor from '../../api/model/Sensor';
 | 
			
		||||
import SensorService from '../../api/service/SensorService';
 | 
			
		||||
import * as ReadAllByTargetActions from '../action/read_all_by_target';
 | 
			
		||||
import ReadAllByTargetPayload from '../payload/ReadAllByTargetPayload';
 | 
			
		||||
 | 
			
		||||
function* readAllByTarget(action: Action<ReadAllByTargetPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {target} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorService>().readAllByTarget, target);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(ReadAllByTargetActions.requestSuccess(retSensor));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(ReadAllByTargetActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchReadAllByTarget(): SagaIterator {
 | 
			
		||||
  yield takeLatest(ReadAllByTargetActions.REQUEST, readAllByTarget);
 | 
			
		||||
}
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
@ -0,0 +1,38 @@
 | 
			
		||||
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 Sensor from '../../api/model/Sensor';
 | 
			
		||||
import SensorService from '../../api/service/SensorService';
 | 
			
		||||
import * as RegistActions from '../action/regist';
 | 
			
		||||
import RegistPayload from '../payload/RegistPayload';
 | 
			
		||||
 | 
			
		||||
function* regist(action: Action<RegistPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {sensor} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorService>().regist, sensor);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(RegistActions.requestSuccess(retSensor));
 | 
			
		||||
  } 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);
 | 
			
		||||
}
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 Sensor from '../../api/model/Sensor';
 | 
			
		||||
import SensorService from '../../api/service/SensorService';
 | 
			
		||||
import * as RemoveActions from '../action/remove';
 | 
			
		||||
import RemovePayload from '../payload/RemovePayload';
 | 
			
		||||
 | 
			
		||||
function* remove(action: Action<RemovePayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {sensor} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorService>().remove, sensor);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(RemoveActions.requestSuccess(retSensor));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(RemoveActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchRemove(): SagaIterator {
 | 
			
		||||
  yield takeLatest(RemoveActions.REQUEST, remove);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 Sensor from '../../api/model/Sensor';
 | 
			
		||||
import SensorService from '../../api/service/SensorService';
 | 
			
		||||
import * as StartActions from '../action/start';
 | 
			
		||||
import StartPayload from '../payload/StartPayload';
 | 
			
		||||
 | 
			
		||||
function* start(action: Action<StartPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {sensor} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorService>().start, sensor);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(StartActions.requestSuccess(retSensor));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(StartActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchStart(): SagaIterator {
 | 
			
		||||
  yield takeLatest(StartActions.REQUEST, start);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 Sensor from '../../api/model/Sensor';
 | 
			
		||||
import SensorService from '../../api/service/SensorService';
 | 
			
		||||
import * as StopActions from '../action/stop';
 | 
			
		||||
import StopPayload from '../payload/StopPayload';
 | 
			
		||||
 | 
			
		||||
function* stop(action: Action<StopPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {sensor} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retSensor = yield call(AppContext.getService<SensorService>().stop, sensor);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(StopActions.requestSuccess(retSensor));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(StopActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchStop(): SagaIterator {
 | 
			
		||||
  yield takeLatest(StopActions.REQUEST, stop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,43 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Created by geek on 17. 7. 3.
 | 
			
		||||
 */
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Target from '../../api/model/Target';
 | 
			
		||||
 | 
			
		||||
import ReadPayload from '../payload/ReadPayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/target/read/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/target/read/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (id: string) => Action<ReadPayload>;
 | 
			
		||||
export type requestSuccess = (target: Target) => Action<Target>;
 | 
			
		||||
export type requestFailure = (error: Error) => Action;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const request: request = (id: string): Action<ReadPayload> => {
 | 
			
		||||
  return {
 | 
			
		||||
      type: REQUEST,
 | 
			
		||||
      payload: {
 | 
			
		||||
        id: id,
 | 
			
		||||
      },
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (target: Target): Action<Target> => {
 | 
			
		||||
  return {
 | 
			
		||||
      type: REQUEST_SUCCESS,
 | 
			
		||||
      payload: target,
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestFailure: requestFailure = (error: Error): Action => {
 | 
			
		||||
  return {
 | 
			
		||||
      type: REQUEST_FAILURE,
 | 
			
		||||
      error: error,
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -4,13 +4,13 @@ import Probe from '@overflow/probe/api/model/Probe';
 | 
			
		||||
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/target/read/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
 | 
			
		||||
export type REQUEST = '@overflow/target/read_all_by_probe/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/target/read_all_by_probe/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/target/read_all_by_probe/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/target/read/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/target/read_all_by_probe/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/read_all_by_probe/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/read_all_by_probe/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (probe: Probe) => Action<ReadAllByProbePayload>;
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,6 @@
 | 
			
		||||
import Action from '@overflow/commons/redux/Action';
 | 
			
		||||
import Target from '../../api/model/Target';
 | 
			
		||||
import RegistPayload from '../payload/RegistPayload';
 | 
			
		||||
import Infra from '@overflow/infra/api/model/Infra';
 | 
			
		||||
import Probe from '@overflow/probe/api/model/Probe';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/target/regist/REQUEST';
 | 
			
		||||
 | 
			
		||||
@ -3,13 +3,13 @@ import Target from '../../api/model/Target';
 | 
			
		||||
import RemovePayload from '../payload/RemovePayload';
 | 
			
		||||
 | 
			
		||||
// Action Type
 | 
			
		||||
export type REQUEST = '@overflow/target/regist/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
 | 
			
		||||
export type REQUEST = '@overflow/target/remove/REQUEST';
 | 
			
		||||
export type REQUEST_SUCCESS = '@overflow/target/remove/REQUEST_SUCCESS';
 | 
			
		||||
export type REQUEST_FAILURE = '@overflow/target/remove/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/target/regist/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
 | 
			
		||||
export const REQUEST: REQUEST = '@overflow/target/remove/REQUEST';
 | 
			
		||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/remove/REQUEST_SUCCESS';
 | 
			
		||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/remove/REQUEST_FAILURE';
 | 
			
		||||
 | 
			
		||||
// Action Creater
 | 
			
		||||
export type request = (target: Target) => Action<RemovePayload>;
 | 
			
		||||
@ -27,10 +27,9 @@ export const request: request = (target: Target): Action<RemovePayload> => {
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const requestSuccess: requestSuccess = (target: Target): Action<Target> => {
 | 
			
		||||
export const requestSuccess: requestSuccess = (): Action<void> => {
 | 
			
		||||
  return {
 | 
			
		||||
    type: REQUEST_SUCCESS,
 | 
			
		||||
    payload: target,
 | 
			
		||||
  };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,22 +9,22 @@ import TargetService from '../../api/service/TargetService';
 | 
			
		||||
import * as ReadActions from '../action/read';
 | 
			
		||||
import ReadPayload from '../payload/ReadPayload';
 | 
			
		||||
 | 
			
		||||
function* read(action: Action<RegistPayload>): SagaIterator {
 | 
			
		||||
function* read(action: Action<ReadPayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {target} = action.payload;
 | 
			
		||||
    const {id} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
 | 
			
		||||
    const retTarget = yield call(AppContext.getService<TargetService>().read, id);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(RegistActions.requestSuccess(retTarget));
 | 
			
		||||
    yield put(ReadActions.requestSuccess(retTarget));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(RegistActions.requestFailure(e));
 | 
			
		||||
    yield put(ReadActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
@ -33,6 +33,6 @@ function* read(action: Action<RegistPayload>): SagaIterator {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchSignin(): SagaIterator {
 | 
			
		||||
  yield takeLatest(RegistActions.REQUEST, regist);
 | 
			
		||||
export function* watchRead(): SagaIterator {
 | 
			
		||||
  yield takeLatest(ReadActions.REQUEST, read);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -9,22 +9,22 @@ import TargetService from '../../api/service/TargetService';
 | 
			
		||||
import * as ReadAllByProbeActions from '../action/read_all_by_probe';
 | 
			
		||||
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
 | 
			
		||||
 | 
			
		||||
function* regist(action: Action<RegistPayload>): SagaIterator {
 | 
			
		||||
function* readAllByProbe(action: Action<ReadAllByProbePayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {target} = action.payload;
 | 
			
		||||
    const {probe} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
 | 
			
		||||
    const retTargets = yield call(AppContext.getService<TargetService>().readAllByProbe, probe);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(RegistActions.requestSuccess(retTarget));
 | 
			
		||||
    yield put(ReadAllByProbeActions.requestSuccess(retTargets));
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(RegistActions.requestFailure(e));
 | 
			
		||||
    yield put(ReadAllByProbeActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
@ -33,6 +33,6 @@ function* regist(action: Action<RegistPayload>): SagaIterator {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchSignin(): SagaIterator {
 | 
			
		||||
  yield takeLatest(RegistActions.REQUEST, regist);
 | 
			
		||||
export function* watchReadAllByProbe(): SagaIterator {
 | 
			
		||||
  yield takeLatest(ReadAllByProbeActions.REQUEST, readAllByProbe);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,6 @@ function* regist(action: Action<RegistPayload>): SagaIterator {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchSignin(): SagaIterator {
 | 
			
		||||
export function* watchRegist(): SagaIterator {
 | 
			
		||||
  yield takeLatest(RegistActions.REQUEST, regist);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +1,38 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 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 Target from '../../api/model/Target';
 | 
			
		||||
import TargetService from '../../api/service/TargetService';
 | 
			
		||||
import * as RemoveActions from '../action/remove';
 | 
			
		||||
import RemovePayload from '../payload/RemovePayload';
 | 
			
		||||
 | 
			
		||||
function* remove(action: Action<RemovePayload>): SagaIterator {
 | 
			
		||||
  try {
 | 
			
		||||
    const {target} = action.payload;
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: true},
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
    yield call(AppContext.getService<TargetService>().remove, target);
 | 
			
		||||
 | 
			
		||||
    // if (responseBody.token === undefined) {
 | 
			
		||||
    //   throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
 | 
			
		||||
    // }
 | 
			
		||||
    yield put(RemoveActions.requestSuccess());
 | 
			
		||||
  } catch (e) {
 | 
			
		||||
    yield put(RemoveActions.requestFailure(e));
 | 
			
		||||
  } finally {
 | 
			
		||||
    // yield put({
 | 
			
		||||
    //   type: types.SENDING_REQUEST,
 | 
			
		||||
    //   payload: {sendingRequest: false},
 | 
			
		||||
    // });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function* watchRemove(): SagaIterator {
 | 
			
		||||
  yield takeLatest(RemoveActions.REQUEST, remove);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user