REFACTOR: Seperated Catagories And Video DB Repositories
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m45s
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m45s
This commit is contained in:
+14
-7
@@ -6,6 +6,8 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"thamanyah/cms/v2/internal/db"
|
||||
"thamanyah/cms/v2/internal/db/repositories"
|
||||
"thamanyah/cms/v2/internal/handlers"
|
||||
"thamanyah/cms/v2/internal/services"
|
||||
|
||||
@@ -32,9 +34,9 @@ func main() {
|
||||
}
|
||||
|
||||
func runMigrate() {
|
||||
concreteDBClient := services.CreateConcreteDbClient(requireDBConnectionString())
|
||||
defer concreteDBClient.CloseConnection()
|
||||
concreteDBClient.Migrate()
|
||||
concreteDBClient := db.CreateDBConnection(requireDBConnectionString())
|
||||
defer db.CloseConnection(concreteDBClient)
|
||||
db.Migrate(concreteDBClient)
|
||||
log.Println("migrations applied successfully")
|
||||
}
|
||||
|
||||
@@ -79,10 +81,15 @@ func runServer() {
|
||||
OutputBucket: mediaConvertOutputBucket,
|
||||
}
|
||||
|
||||
concreteDBClient := services.CreateConcreteDbClient(requireDBConnectionString())
|
||||
defer concreteDBClient.CloseConnection()
|
||||
concreteDBClient.AssertSuccessfulConnection(context.Background())
|
||||
services.DB = concreteDBClient
|
||||
concreteDBClient := db.CreateDBConnection(requireDBConnectionString())
|
||||
defer db.CloseConnection(concreteDBClient)
|
||||
db.AssertSuccessfulConnection(context.Background(), concreteDBClient)
|
||||
repositories.VideoRepo = &repositories.ConcreteVideoRepository{
|
||||
SQLDB: concreteDBClient,
|
||||
}
|
||||
repositories.CatagoriesRepo = &repositories.ConcreteCatagoriesRepository{
|
||||
SQLDB: concreteDBClient,
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user