mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
Renamed the 'Article' domain to 'Post' in order to better reflect the purpose and utility of the object. The change involved renaming all related use cases, classes, and other references from 'Article' to 'Post' and updating all functions and data types to work with Posts instead of Articles.
38 lines
570 B
Go
38 lines
570 B
Go
package post
|
|
|
|
import "time"
|
|
|
|
type Post struct {
|
|
ID uint32 `json:"id"`
|
|
Title string `json:"title"`
|
|
Body string `json:"body"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
func FromApi(
|
|
title string,
|
|
body string,
|
|
) Post {
|
|
return Post{
|
|
Title: title,
|
|
Body: body,
|
|
}
|
|
}
|
|
|
|
func FromDb(
|
|
id uint32,
|
|
title string,
|
|
body string,
|
|
createdAt time.Time,
|
|
updatedAt time.Time,
|
|
) Post {
|
|
return Post{
|
|
ID: id,
|
|
Title: title,
|
|
Body: body,
|
|
CreatedAt: createdAt,
|
|
UpdatedAt: updatedAt,
|
|
}
|
|
}
|