Skip to content

Commit 893486f

Browse files
committed
feat: wire up endpoints manager in main
1 parent d21bc16 commit 893486f

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

internal/endpoints/manager.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@ import (
66
"github.com/maniac-en/req/internal/database"
77
)
88

9-
func NewEndpointsManager(db *database.Queries) *EndpointManager {
10-
return &EndpointManager{DB: db}
9+
func NewEndpointsManager(db *database.Queries) *EndpointsManager {
10+
return &EndpointsManager{DB: db}
1111
}
1212

13-
func (e *EndpointManager) Create(ctx context.Context, name string) (EndpointEntity, error) {
13+
func (e *EndpointsManager) Create(ctx context.Context, name string) (EndpointEntity, error) {
1414
return EndpointEntity{}, nil
1515
}
1616

17-
func (e *EndpointManager) Read(ctx context.Context, id int64) (EndpointEntity, error) {
17+
func (e *EndpointsManager) Read(ctx context.Context, id int64) (EndpointEntity, error) {
1818
return EndpointEntity{}, nil
1919
}
2020

21-
func (e *EndpointManager) Update(ctx context.Context, id int64, name string) (EndpointEntity, error) {
21+
func (e *EndpointsManager) Update(ctx context.Context, id int64, name string) (EndpointEntity, error) {
2222
return EndpointEntity{}, nil
2323
}
2424

25-
func (e *EndpointManager) Delete(ctx context.Context, id int64) error {
25+
func (e *EndpointsManager) Delete(ctx context.Context, id int64) error {
2626
return nil
2727
}
2828

29-
func (e *EndpointManager) List(ctx context.Context) ([]EndpointEntity, error) {
29+
func (e *EndpointsManager) List(ctx context.Context) ([]EndpointEntity, error) {
3030
return nil, nil
3131
}
3232

33-
func (e *EndpointManager) ListPaginated(ctx context.Context, limit, offset int) (*PaginatedEndpoints, error) {
33+
func (e *EndpointsManager) ListPaginated(ctx context.Context, limit, offset int) (*PaginatedEndpoints, error) {
3434
return nil, nil
3535
}

internal/endpoints/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (c EndpointEntity) GetUpdatedAt() time.Time {
3737
return parsed
3838
}
3939

40-
type EndpointManager struct {
40+
type EndpointsManager struct {
4141
DB *database.Queries
4242
}
4343

main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/maniac-en/req/internal/app"
1616
"github.com/maniac-en/req/internal/collections"
1717
"github.com/maniac-en/req/internal/database"
18+
"github.com/maniac-en/req/internal/endpoints"
1819
"github.com/maniac-en/req/internal/history"
1920
"github.com/maniac-en/req/internal/http"
2021
"github.com/maniac-en/req/internal/log"
@@ -38,9 +39,9 @@ var (
3839
type Config struct {
3940
DB *database.Queries
4041
Collections *collections.CollectionsManager
42+
Endpoints *endpoints.EndpointsManager
4143
HTTP *http.HTTPManager
4244
History *history.HistoryManager
43-
// TODO: Add Endpoints *endpoints.EndpointsManager when endpoints package is refactored
4445
}
4546

4647
func initPaths() error {
@@ -134,18 +135,20 @@ func main() {
134135
// create database client and managers
135136
db := database.New(DB)
136137
collectionsManager := collections.NewCollectionsManager(db)
138+
endpointsManager := endpoints.NewEndpointsManager(db)
137139
httpManager := http.NewHTTPManager()
138140
historyManager := history.NewHistoryManager(db)
139141

140142
config := &Config{
141143
DB: db,
142144
Collections: collectionsManager,
145+
Endpoints: endpointsManager,
143146
HTTP: httpManager,
144147
History: historyManager,
145148
}
146149

147-
log.Info("application initialized", "components", []string{"database", "collections", "http", "history", "logging"})
148-
log.Debug("configuration loaded", "collections_manager", config.Collections != nil, "database", config.DB != nil, "http_manager", config.HTTP != nil, "history_manager", config.History != nil)
150+
log.Info("application initialized", "components", []string{"database", "collections", "endpoints", "http", "history", "logging"})
151+
log.Debug("configuration loaded", "collections_manager", config.Collections != nil, "endpoints", config.Endpoints != nil, "database", config.DB != nil, "http_manager", config.HTTP != nil, "history_manager", config.History != nil)
149152
log.Info("application started successfully")
150153

151154
// Entry point for UI

0 commit comments

Comments
 (0)