Skip to content

Commit

Permalink
setting model (#71)
Browse files Browse the repository at this point in the history
closes #71
  • Loading branch information
dheidemann committed Jul 29, 2024
1 parent 7950a91 commit 3af6743
Show file tree
Hide file tree
Showing 7 changed files with 805 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/db/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ func Init(ctx context.Context, tracer *trace.TracerProvider) (*bun.DB, *sql.DB,
db_pw := os.Getenv("POSTGRES_PASSWORD")
db_db := os.Getenv("POSTGRES_DB")
dsn := fmt.Sprintf("postgres://%s:%s@postgres:5432/%s?sslmode=disable",
db_user,
db_pw,
db_db)
db_user, db_pw, db_db)

sqldb := sql.OpenDB(pgdriver.NewConnector(pgdriver.WithDSN(dsn)))

Expand All @@ -44,7 +42,8 @@ func Init(ctx context.Context, tracer *trace.TracerProvider) (*bun.DB, *sql.DB,
(*models.User)(nil),
(*models.Building)(nil),
(*models.Room)(nil),
(*models.Answer)(nil)}
(*models.Answer)(nil),
(*models.Setting)(nil)}

for _, relation := range relations {
db.RegisterModel(relation)
Expand Down
4 changes: 4 additions & 0 deletions server/gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,7 @@ models:
model: github.com/FachschaftMathPhysInfo/pepp/server/models.RoomToEvent
NewEventToTutorLink:
model: github.com/FachschaftMathPhysInfo/pepp/server/models.EventToTutor
Setting:
model: github.com/FachschaftMathPhysInfo/pepp/server/models.Setting
NewSetting:
model: github.com/FachschaftMathPhysInfo/pepp/server/models.Setting
Loading

0 comments on commit 3af6743

Please sign in to comment.