massive draft for payment process (UNCOMPLETE)
This commit is contained in:
@@ -14,7 +14,7 @@ type peerMongoAccessor struct {
|
||||
}
|
||||
|
||||
// New creates a new instance of the peerMongoAccessor
|
||||
func NewShallow() *peerMongoAccessor {
|
||||
func NewShallowAccessor() *peerMongoAccessor {
|
||||
return &peerMongoAccessor{
|
||||
utils.AbstractAccessor{
|
||||
Logger: logs.CreateLogger(tools.PEER.String()), // Create a logger with the data type
|
||||
@@ -23,15 +23,12 @@ func NewShallow() *peerMongoAccessor {
|
||||
}
|
||||
}
|
||||
|
||||
func New(t tools.DataType, username string, peerID string, groups []string, caller *tools.HTTPCaller) *peerMongoAccessor {
|
||||
func NewAccessor(request *tools.APIRequest) *peerMongoAccessor {
|
||||
return &peerMongoAccessor{
|
||||
utils.AbstractAccessor{
|
||||
Logger: logs.CreateLogger(t.String()), // Create a logger with the data type
|
||||
Caller: caller,
|
||||
PeerID: peerID,
|
||||
User: username,
|
||||
Groups: groups, // Set the caller
|
||||
Type: t,
|
||||
Logger: logs.CreateLogger(tools.PEER.String()), // Create a logger with the data type
|
||||
Request: request,
|
||||
Type: tools.PEER,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -62,17 +59,17 @@ func (dca *peerMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||
}, dca)
|
||||
}
|
||||
|
||||
func (wfa *peerMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
|
||||
func (wfa *peerMongoAccessor) LoadAll(isDraft bool) ([]utils.ShallowDBObject, int, error) {
|
||||
return utils.GenericLoadAll[*Peer](func(d utils.DBObject) utils.ShallowDBObject {
|
||||
return d
|
||||
}, wfa)
|
||||
}, isDraft, wfa)
|
||||
}
|
||||
|
||||
func (wfa *peerMongoAccessor) Search(filters *dbs.Filters, search string) ([]utils.ShallowDBObject, int, error) {
|
||||
func (wfa *peerMongoAccessor) Search(filters *dbs.Filters, search string, isDraft bool) ([]utils.ShallowDBObject, int, error) {
|
||||
return utils.GenericSearch[*Peer](filters, search, wfa.getDefaultFilter(search),
|
||||
func(d utils.DBObject) utils.ShallowDBObject {
|
||||
return d
|
||||
}, wfa)
|
||||
}, isDraft, wfa)
|
||||
}
|
||||
func (a *peerMongoAccessor) getDefaultFilter(search string) *dbs.Filters {
|
||||
s, err := strconv.Atoi(search)
|
||||
|
||||
Reference in New Issue
Block a user