2021-08-28 18:41:34 +03:00
|
|
|
package repositories
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
func getFile(id, postId int, name string) File {
|
|
|
|
return File{
|
|
|
|
ID: id,
|
|
|
|
PostID: postId,
|
|
|
|
Name: name,
|
|
|
|
Ext: "image/jpeg",
|
|
|
|
Size: 10000,
|
|
|
|
CreatedAt: time.Now(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getPost(id, threadID int) Post {
|
|
|
|
return Post{
|
|
|
|
ID: id,
|
|
|
|
ThreadID: threadID,
|
|
|
|
Title: "Basic Title",
|
|
|
|
Text: "Basic Text",
|
|
|
|
IsSage: false,
|
|
|
|
Files: []File{
|
2021-08-28 19:57:50 +03:00
|
|
|
getFile(2, id, "https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png"),
|
|
|
|
getFile(1, id, "https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png"),
|
2021-08-28 18:41:34 +03:00
|
|
|
},
|
|
|
|
CreatedAt: time.Now(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func getThread(id int) Thread {
|
|
|
|
return Thread{
|
|
|
|
ID: id,
|
|
|
|
CreatedAt: time.Now(),
|
|
|
|
UpdatedAt: time.Now(),
|
|
|
|
Posts: []Post{
|
|
|
|
getPost(1, id),
|
|
|
|
getPost(1, id),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var ThreadsDb = []Thread{
|
|
|
|
getThread(1),
|
|
|
|
getThread(2),
|
|
|
|
getThread(3),
|
|
|
|
}
|
|
|
|
|
|
|
|
type ThreadsRepository struct{}
|
|
|
|
|
|
|
|
var Threads ThreadsRepository
|
|
|
|
|
|
|
|
func (r *ThreadsRepository) Get() []Thread {
|
|
|
|
return ThreadsDb
|
|
|
|
}
|