Compare commits
2 Commits
00ab98072b
...
c7176fadf6
| Author | SHA1 | Date | |
|---|---|---|---|
| c7176fadf6 | |||
| bc4354bf7b |
@ -3,8 +3,6 @@ package domain
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jackc/pgx/v5/pgtype"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
@ -31,14 +29,14 @@ type (
|
|||||||
CategoryCore
|
CategoryCore
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Creator User `json:"creator"`
|
Creator User `json:"creator"`
|
||||||
Notes pgtype.Text `json:"notes"`
|
Notes *string `json:"notes"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
FileCore struct {
|
FileCore struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name pgtype.Text `json:"name"`
|
Name *string `json:"name"`
|
||||||
MIME MIME `json:"mime"`
|
MIME MIME `json:"mime"`
|
||||||
}
|
}
|
||||||
FileItem struct {
|
FileItem struct {
|
||||||
@ -50,7 +48,7 @@ type (
|
|||||||
FileCore
|
FileCore
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Creator User `json:"creator"`
|
Creator User `json:"creator"`
|
||||||
Notes pgtype.Text `json:"notes"`
|
Notes *string `json:"notes"`
|
||||||
Metadata json.RawMessage `json:"metadata"`
|
Metadata json.RawMessage `json:"metadata"`
|
||||||
Viewed int `json:"viewed"`
|
Viewed int `json:"viewed"`
|
||||||
}
|
}
|
||||||
@ -60,7 +58,7 @@ type (
|
|||||||
TagCore struct {
|
TagCore struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Color pgtype.Text `json:"color"`
|
Color *string `json:"color"`
|
||||||
}
|
}
|
||||||
TagItem struct {
|
TagItem struct {
|
||||||
TagCore
|
TagCore
|
||||||
@ -71,7 +69,7 @@ type (
|
|||||||
Category CategoryCore `json:"category"`
|
Category CategoryCore `json:"category"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Creator User `json:"creator"`
|
Creator User `json:"creator"`
|
||||||
Notes pgtype.Text `json:"notes"`
|
Notes *string `json:"notes"`
|
||||||
UsedIncl int `json:"usedIncl"`
|
UsedIncl int `json:"usedIncl"`
|
||||||
UsedExcl int `json:"usedExcl"`
|
UsedExcl int `json:"usedExcl"`
|
||||||
}
|
}
|
||||||
@ -95,7 +93,7 @@ type (
|
|||||||
PoolCore
|
PoolCore
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
Creator User `json:"creator"`
|
Creator User `json:"creator"`
|
||||||
Notes pgtype.Text `json:"notes"`
|
Notes *string `json:"notes"`
|
||||||
Viewed int `json:"viewed"`
|
Viewed int `json:"viewed"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -5,7 +5,7 @@ type ErrorCode string
|
|||||||
const (
|
const (
|
||||||
// File errors
|
// File errors
|
||||||
ErrFileNotFound ErrorCode = "FILE_NOT_FOUND"
|
ErrFileNotFound ErrorCode = "FILE_NOT_FOUND"
|
||||||
ErrMIMENotSupported ErrorCode = "MIME_NOT_SUPPORTEDF"
|
ErrMIMENotSupported ErrorCode = "MIME_NOT_SUPPORTED"
|
||||||
|
|
||||||
// Tag errors
|
// Tag errors
|
||||||
ErrTagNotFound ErrorCode = "TAG_NOT_FOUND"
|
ErrTagNotFound ErrorCode = "TAG_NOT_FOUND"
|
||||||
|
|||||||
@ -198,8 +198,7 @@ func (s *FileRepository) Add(ctx context.Context, user_id int, name, mime string
|
|||||||
domainErr = domain.NewUnexpectedError(err)
|
domainErr = domain.NewUnexpectedError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
file.Name.String = name
|
file.Name = &name
|
||||||
file.Name.Valid = (name != "")
|
|
||||||
file.MIME.Name = mime
|
file.MIME.Name = mime
|
||||||
file.MIME.Extension = extension
|
file.MIME.Extension = extension
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user