feat: update model
This commit is contained in:
@@ -7,7 +7,7 @@ CREATE TABLE posts(
|
||||
deleted_at timestamp,
|
||||
status int2 NOT NULL DEFAULT 0,
|
||||
title varchar(128) NOT NULL,
|
||||
head_image int8 NOT NULL DEFAULT 0,
|
||||
head_images jsonb DEFAULT '[]' ::jsonb NOT NULL,
|
||||
description varchar(256) NOT NULL,
|
||||
content text NOT NULL,
|
||||
price int8 NOT NULL DEFAULT 0,
|
||||
|
||||
@@ -27,4 +27,5 @@ type Posts struct {
|
||||
Likes int64 `json:"likes"`
|
||||
Tags fields.Json[[]string] `json:"tags"`
|
||||
Assets fields.Json[[]fields.MediaAsset] `json:"assets"`
|
||||
HeadImages string `json:"head_images"`
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ type postsTable struct {
|
||||
Likes postgres.ColumnInteger
|
||||
Tags postgres.ColumnString
|
||||
Assets postgres.ColumnString
|
||||
HeadImages postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
@@ -85,8 +86,9 @@ func newPostsTableImpl(schemaName, tableName, alias string) postsTable {
|
||||
LikesColumn = postgres.IntegerColumn("likes")
|
||||
TagsColumn = postgres.StringColumn("tags")
|
||||
AssetsColumn = postgres.StringColumn("assets")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn}
|
||||
HeadImagesColumn = postgres.StringColumn("head_images")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn, HeadImagesColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn, HeadImagesColumn}
|
||||
)
|
||||
|
||||
return postsTable{
|
||||
@@ -107,6 +109,7 @@ func newPostsTableImpl(schemaName, tableName, alias string) postsTable {
|
||||
Likes: LikesColumn,
|
||||
Tags: TagsColumn,
|
||||
Assets: AssetsColumn,
|
||||
HeadImages: HeadImagesColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
|
||||
Reference in New Issue
Block a user