validator

This commit is contained in:
mr
2024-07-18 18:14:12 +02:00
parent cc4cc49617
commit 4f4e2949d6
9 changed files with 47 additions and 1 deletions

View File

@@ -18,6 +18,10 @@ func (pma *ProcessingMongoAccessor) UpdateOne(set map[string]interface{}, id str
}
func (pma *ProcessingMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, error) {
err := pma.Validate(data.(*Processing))
if err != nil {
return nil, err
}
id, err := mongo.MONGOService.StoreOne(data.(*Processing), pma.GetType())
if err != nil {
pma.Logger.Error().Msg("Could not store " + data.GetName() + " to db. Error: " + err.Error())