feat: complte media store

This commit is contained in:
Rogee
2024-12-06 15:06:15 +08:00
parent 43bde1e62a
commit 7d446b46c2
10 changed files with 199 additions and 226 deletions

View File

@@ -9,13 +9,12 @@ package model
import (
"backend/pkg/pg"
"github.com/google/uuid"
"time"
)
type Medias struct {
ID int64 `sql:"primary_key" json:"id"`
UUID uuid.UUID `json:"uuid"`
Hash string `json:"hash"`
TenantID int64 `json:"tenant_id"`
Title string `json:"title"`
Description string `json:"description"`

View File

@@ -18,7 +18,7 @@ type mediasTable struct {
// Columns
ID postgres.ColumnInteger
UUID postgres.ColumnString
Hash postgres.ColumnString
TenantID postgres.ColumnInteger
Title postgres.ColumnString
Description postgres.ColumnString
@@ -69,7 +69,7 @@ func newMediasTable(schemaName, tableName, alias string) *MediasTable {
func newMediasTableImpl(schemaName, tableName, alias string) mediasTable {
var (
IDColumn = postgres.IntegerColumn("id")
UUIDColumn = postgres.StringColumn("uuid")
HashColumn = postgres.StringColumn("hash")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
TitleColumn = postgres.StringColumn("title")
DescriptionColumn = postgres.StringColumn("description")
@@ -79,8 +79,8 @@ func newMediasTableImpl(schemaName, tableName, alias string) mediasTable {
ResourcesColumn = postgres.StringColumn("resources")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, UUIDColumn, TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, ResourcesColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{UUIDColumn, TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, ResourcesColumn, CreatedAtColumn, UpdatedAtColumn}
allColumns = postgres.ColumnList{IDColumn, HashColumn, TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, ResourcesColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{HashColumn, TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, ResourcesColumn, CreatedAtColumn, UpdatedAtColumn}
)
return mediasTable{
@@ -88,7 +88,7 @@ func newMediasTableImpl(schemaName, tableName, alias string) mediasTable {
//Columns
ID: IDColumn,
UUID: UUIDColumn,
Hash: HashColumn,
TenantID: TenantIDColumn,
Title: TitleColumn,
Description: DescriptionColumn,