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
|
||||
*/
|
||||
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) {
|
||||
utils.GenericDeleteOne(id, a)
|
||||
return nil, 404, nil
|
||||
|
||||
@@ -199,6 +199,7 @@ const (
|
||||
PB_DELETE
|
||||
PB_PLANNER
|
||||
PB_CLOSE_PLANNER
|
||||
PB_CONSIDERS
|
||||
NONE
|
||||
)
|
||||
|
||||
@@ -218,12 +219,14 @@ func GetActionString(ss string) PubSubAction {
|
||||
return PB_PLANNER
|
||||
case "close_planner":
|
||||
return PB_CLOSE_PLANNER
|
||||
case "considers":
|
||||
return PB_CONSIDERS
|
||||
default:
|
||||
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 {
|
||||
return strings.ToUpper(path[m])
|
||||
|
||||
Reference in New Issue
Block a user