sensor etc added

This commit is contained in:
geek 2017-06-09 16:27:44 +09:00
parent 0651a472bb
commit aefe450b95
9 changed files with 185 additions and 1 deletions

View File

@ -174,7 +174,7 @@ func (es *EmailService) saveEmail(e *Email) {
func (es *EmailService) CheckAuthURL(e *Email) bool {
//Todo Query from the database with an authentication token.
//Query from the database with an authentication token.
emMap := es.getEmailMap(e)
@ -185,6 +185,8 @@ func (es *EmailService) CheckAuthURL(e *Email) bool {
r := strings.Compare(e.AuthToken, tempEmail.AuthToken)
//Todo Check for valid
log.Println(tempEmail)
if r == 0 {
// Todo isConfirm change true and db update

46
proxy/sensor/sensor.go Normal file
View File

@ -0,0 +1,46 @@
package sensor
import (
"encoding/json"
"git.loafle.net/overflow/commons_go/model/timestamp"
"git.loafle.net/overflow/overflow_proxy_service/proxy/target"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
)
type Sensor struct {
Id json.Number `json:"id,Number,omitempty"`
Target target.Target `json:"target,omitempty"`
Notification string `json:"notification,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorService struct {
}
func NewSensorService() *SensorService {
return &SensorService{}
}
func (ss *SensorService) Create(s *Sensor) (string, error) {
out, err := utils.InvokeDB("sensor", "create", s)
if err != nil {
return "", err
}
return out, nil
}
func (ss *SensorService)List(t *target.Target) (string, error) {
out, err := utils.InvokeDBByModel("sensor", "findAllByTargetId", t, "com.loafle.overflow.target.model.Target")
if err != nil {
return "", err
}
return out, nil;
}

View File

@ -0,0 +1 @@
package sensor

View File

@ -0,0 +1,52 @@
package sensorItem
import (
"encoding/json"
"github.com/golang/protobuf/ptypes/timestamp"
"git.loafle.net/overflow/crawler_go"
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensorItemCategory"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
"git.loafle.net/overflow/overflow_proxy_service/proxy/target"
)
type SensorItem struct {
Id json.Number `json:"id,Number,omitempty"`
Crawler crawler.Crawler `json:"crawler,omitempty"`
SensorItemCategory sensorItemCategory.SensorItemCategory `json:"sensorItemCategory,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
DataType string `json:"dataType,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorItemService struct {
}
func NewSensorItemService() (*SensorItemService) {
return &SensorItemService{}
}
func (sis *SensorItemService) Create(si *SensorItem) (string, error){
out, err := utils.InvokeDB("sensorItem", "create", si)
if err != nil {
return "", err
}
return out, nil
}
func (ss *SensorItemService)List(cr *crawler.Crawler) (string, error) {
out, err := utils.InvokeDBByModel("sensorItem", "findAllByCrawlerId", cr, "com.loafle.overflow.crawler.model.Crawler")
if err != nil {
return "", err
}
return out, nil;
}

View File

@ -0,0 +1 @@
package sensorItem

View File

@ -0,0 +1,32 @@
package sensorItemCategory
import (
"encoding/json"
"git.loafle.net/overflow/commons_go/model/timestamp"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
)
type SensorItemCategory struct {
Id json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorItemCategoryService struct {
}
func NewSensorItemCategoryService () (*SensorItemCategoryService ) {
return &SensorItemCategoryService{}
}
func (sics *SensorItemCategoryService) Create(sic *SensorItemCategory) (string, error){
out, err := utils.InvokeDB("sensorItemCategory", "create", sic)
if err != nil {
return "", err
}
return out, nil
}

View File

@ -0,0 +1 @@
package sensorItemCategory

View File

@ -0,0 +1,48 @@
package sensorItemMapping
import (
"encoding/json"
"git.loafle.net/overflow/commons_go/model/timestamp"
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensor"
"git.loafle.net/overflow/overflow_proxy_service/proxy/sensorItem"
"git.loafle.net/overflow/overflow_proxy_service/proxy/utils"
)
type SensorItemMapping struct {
Id json.Number `json:"id,Number,omitempty"`
Sensor sensor.Sensor `json:"sensor,omitempty"`
SensorItem sensorItem.SensorItem `json:"sensorItem,omitempty"`
CreateDate timestamp.Timestamp `json:"createDate,omitempty"`
}
type SensorItemMappingService struct {
}
func NewSensorItemMappingService() (*SensorItemMappingService) {
return &SensorItemMappingService{}
}
func (sims *SensorItemMappingService) Create(sim *SensorItemMapping) (string, error) {
out, err := utils.InvokeDB("sensorItemMapping", "create", sim)
if err != nil {
return "", err
}
return out, nil
}
func (ss *SensorItemMappingService)List(s *sensor.Sensor) (string, error) {
out, err := utils.InvokeDBByModel("sensorItemMapping", "findAllBySensorId", s, "com.loafle.overflow.sensor.model.Sensor")
if err != nil {
return "", err
}
return out, nil;
}

View File

@ -0,0 +1 @@
package sensorItemMapping