set up
This commit is contained in:
@@ -28,7 +28,7 @@ func NewAccessor(request *tools.APIRequest) *PurchaseResourceMongoAccessor {
|
|||||||
* Nothing special here, just the basic CRUD operations
|
* Nothing special here, just the basic CRUD operations
|
||||||
*/
|
*/
|
||||||
func (a *PurchaseResourceMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
func (a *PurchaseResourceMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||||
return utils.GenericLoadOne[*PurchaseResource](id, a.New(), func(d utils.DBObject) (utils.DBObject, int, error) {
|
return utils.GenericLoadOne(id, a.New(), func(d utils.DBObject) (utils.DBObject, int, error) {
|
||||||
if d.(*PurchaseResource).EndDate != nil && time.Now().UTC().After(*d.(*PurchaseResource).EndDate) {
|
if d.(*PurchaseResource).EndDate != nil && time.Now().UTC().After(*d.(*PurchaseResource).EndDate) {
|
||||||
utils.GenericDeleteOne(id, a)
|
utils.GenericDeleteOne(id, a)
|
||||||
return nil, 404, nil
|
return nil, 404, nil
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ const (
|
|||||||
PB_DELETE
|
PB_DELETE
|
||||||
PB_PLANNER
|
PB_PLANNER
|
||||||
PB_CLOSE_PLANNER
|
PB_CLOSE_PLANNER
|
||||||
|
PB_CONSIDERS
|
||||||
NONE
|
NONE
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -218,12 +219,14 @@ func GetActionString(ss string) PubSubAction {
|
|||||||
return PB_PLANNER
|
return PB_PLANNER
|
||||||
case "close_planner":
|
case "close_planner":
|
||||||
return PB_CLOSE_PLANNER
|
return PB_CLOSE_PLANNER
|
||||||
|
case "considers":
|
||||||
|
return PB_CONSIDERS
|
||||||
default:
|
default:
|
||||||
return NONE
|
return NONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = []string{"search", "search_response", "create", "update", "delete", "planner", "close_planner"}
|
var path = []string{"search", "search_response", "create", "update", "delete", "planner", "close_planner", "considers"}
|
||||||
|
|
||||||
func (m PubSubAction) String() string {
|
func (m PubSubAction) String() string {
|
||||||
return strings.ToUpper(path[m])
|
return strings.ToUpper(path[m])
|
||||||
|
|||||||
Reference in New Issue
Block a user