Mock time (#2)

This commit is contained in:
Jonas Plum
2021-12-27 00:17:44 +01:00
committed by GitHub
parent 0286574692
commit 1fade14ba5
19 changed files with 916 additions and 969 deletions

View File

@@ -3,23 +3,23 @@ package busdb
import (
"context"
"errors"
"time"
"github.com/arangodb/go-driver"
"github.com/SecurityBrewery/catalyst/generated/models"
"github.com/SecurityBrewery/catalyst/time"
)
const LogCollectionName = "logs"
func (db *BusDatabase) LogCreate(ctx context.Context, id, message string) (*models.LogEntry, error) {
func (db *BusDatabase) LogCreate(ctx context.Context, reference, message string) (*models.LogEntry, error) {
user, ok := UserFromContext(ctx)
if !ok {
return nil, errors.New("no user in context")
}
logentry := &models.LogEntry{
Reference: id,
Reference: reference,
Created: time.Now(),
Creator: user.ID,
Message: message,