feat: add medias

This commit is contained in:
Rogee
2024-12-02 17:48:46 +08:00
parent 2b4cfb1a1e
commit 9e7b35e3c9
17 changed files with 806 additions and 11 deletions

View File

@@ -2,3 +2,6 @@ ignores: [] # ignore tables
types:
users: # table name
oauth: backend/pkg/pg.UserOAuth
media_resources: # table name
type: backend/pkg/pg.MediaType

View File

@@ -72,7 +72,7 @@ CREATE TABLE
title VARCHAR(198) NOT NULL,
description VARCHAR(198) NOT NULL,
price INT8 NOT NULL,
discount INT8 NOT NULL,
discount INT8 NOT NULL default 100,
publish BOOL NOT NULL,
created_at timestamp NOT NULL default now(),
updated_at timestamp NOT NULL default now()

View File

@@ -8,16 +8,17 @@
package model
import (
"backend/pkg/pg"
"time"
)
type MediaResources struct {
ID int64 `sql:"primary_key" json:"id"`
MediaID int64 `json:"media_id"`
Type string `json:"type"`
Source *string `json:"source"`
Size int64 `json:"size"`
Publish bool `json:"publish"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ID int64 `sql:"primary_key" json:"id"`
MediaID int64 `json:"media_id"`
Type pg.MediaType `json:"type"`
Source *string `json:"source"`
Size int64 `json:"size"`
Publish bool `json:"publish"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}