clean: Article to Post in domain and related use cases

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.
This commit is contained in:
Florian Sylvain
2023-09-06 01:56:27 +02:00
parent 46491a688b
commit 554fdc1989
18 changed files with 274 additions and 271 deletions
+6 -4
View File
@@ -12,16 +12,18 @@ import (
"time"
)
const testDbFile = "test.db"
var ApiUrl string
var AuthorizationCookie *http.Cookie
var HttpClient = http.Client{}
func GetDb() *gorm.DB {
db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
db, err := gorm.Open(sqlite.Open(testDbFile), &gorm.Config{})
if err != nil {
panic(err)
}
_ = db.AutoMigrate(&models.Article{}, &models.User{})
_ = db.AutoMigrate(&models.Post{}, &models.User{})
return db
}
@@ -30,8 +32,8 @@ func StartServerIfNotAlready() {
if err == nil {
return
}
_ = os.Remove("test.db")
_ = os.Setenv("DB_FILE", "test.db")
_ = os.Remove(testDbFile)
_ = os.Setenv("DB_FILE", testDbFile)
go func(url *string) {
router := server.InitServer()
*url = "http://localhost:" + os.Getenv("PORT") + "/v1"