uuid used

This commit is contained in:
2026-02-20 15:06:15 +02:00
parent 35e83ed705
commit 8546ad496f
31 changed files with 265 additions and 238 deletions
+14 -14
View File
@@ -41,9 +41,9 @@ type FileInfoResult struct {
ContentDigest string
ContentCreatedAt string
ContentCreatedBy string
ContentCreatedBy auxuuid.UUID
ContentUpdatedAt string
ContentUpdatedBy string
ContentUpdatedBy auxuuid.UUID
}
func cleanFilepath(filename string) (string, error) {
@@ -51,7 +51,7 @@ func cleanFilepath(filename string) (string, error) {
return filepath.Clean(filename), nil
}
func (oper *Operator) FileInfo(ctx context.Context, operID string, param *FileInfoParams) (int, *FileInfoResult, error) {
func (oper *Operator) FileInfo(ctx context.Context, operatorID auxuuid.UUID, param *FileInfoParams) (int, *FileInfoResult, error) {
var err error
code := http.StatusOK
res := &FileInfoResult{}
@@ -101,7 +101,7 @@ type PutFileResult struct{}
const defaultContentType = "application/octet-stream"
// TODO: checking catalog and file names conflict
func (oper *Operator) PutFile(ctx context.Context, operID string, param *PutFileParams) (int, *PutFileResult, error) {
func (oper *Operator) PutFile(ctx context.Context, operatorID auxuuid.UUID, param *PutFileParams) (int, *PutFileResult, error) {
var err error
res := &PutFileResult{}
@@ -147,7 +147,7 @@ func (oper *Operator) PutFile(ctx context.Context, operID string, param *PutFile
fileDescr.Checksum = checksum
fileDescr.UpdatedAt = now
fileDescr.Type = contentType
fileDescr.UpdatedBy = operID
fileDescr.UpdatedBy = operatorID
err = oper.mdb.UpdateFileByID(ctx, fileDescr.ID, fileDescr)
if err != nil {
code := http.StatusInternalServerError
@@ -163,8 +163,8 @@ func (oper *Operator) PutFile(ctx context.Context, operID string, param *PutFile
Checksum: checksum,
CreatedAt: now,
UpdatedAt: now,
CreatedBy: operID,
UpdatedBy: operID,
CreatedBy: operatorID,
UpdatedBy: operatorID,
}
err = oper.mdb.InsertFile(ctx, fileDescr)
if err != nil {
@@ -193,12 +193,12 @@ type GetFileResult struct {
Source io.ReadCloser
ContentCreatedAt string
ContentCreatedBy string
ContentCreatedBy auxuuid.UUID
ContentUpdatedAt string
ContentUpdatedBy string
ContentUpdatedBy auxuuid.UUID
}
func (oper *Operator) GetFile(ctx context.Context, operID string, param *GetFileParams) (int, *GetFileResult, error) {
func (oper *Operator) GetFile(ctx context.Context, operatorID auxuuid.UUID, param *GetFileParams) (int, *GetFileResult, error) {
var err error
res := &GetFileResult{}
@@ -247,7 +247,7 @@ type DeleteFileParams struct {
}
type DeleteFileResult struct{}
func (oper *Operator) DeleteFile(ctx context.Context, operID string, param *DeleteFileParams) (int, *DeleteFileResult, error) {
func (oper *Operator) DeleteFile(ctx context.Context, operatorID auxuuid.UUID, param *DeleteFileParams) (int, *DeleteFileResult, error) {
var err error
res := &DeleteFileResult{}
code := http.StatusOK
@@ -294,7 +294,7 @@ type ListFilesResult struct {
Files []descr.File `json:"files,omitempty"`
}
func (oper *Operator) ListFiles(ctx context.Context, operID string, params *ListFilesParams) (int, *ListFilesResult, error) {
func (oper *Operator) ListFiles(ctx context.Context, operatorID auxuuid.UUID, params *ListFilesParams) (int, *ListFilesResult, error) {
var err error
res := &ListFilesResult{
Files: make([]descr.File, 0),
@@ -406,7 +406,7 @@ type ListCollectionsResult struct {
Collections []string `json:"collection,omitempty"`
}
func (oper *Operator) ListCollections(ctx context.Context, operID string, param *ListCollectionsParams) (int, *ListCollectionsResult, error) {
func (oper *Operator) ListCollections(ctx context.Context, operatorID auxuuid.UUID, param *ListCollectionsParams) (int, *ListCollectionsResult, error) {
var err error
res := &ListCollectionsResult{
Collections: make([]string, 0),
@@ -539,7 +539,7 @@ type DeleteColletionResult struct {
Files []descr.File `json:"files,omitempty"`
}
func (oper *Operator) DeleteColletion(ctx context.Context, operID string, param *DeleteColletionParams) (int, *DeleteColletionResult, error) {
func (oper *Operator) DeleteColletion(ctx context.Context, operatorID auxuuid.UUID, param *DeleteColletionParams) (int, *DeleteColletionResult, error) {
var err error
res := &DeleteColletionResult{
Files: make([]descr.File, 0),