features/added-user-tables #3

Merged
jtom38 merged 7 commits from features/added-user-tables into main 2024-04-26 16:06:36 -07:00
Showing only changes of commit d35b955815 - Show all commits

View File

@ -18,7 +18,8 @@ type Handler struct {
Router *echo.Echo Router *echo.Echo
Db *database.Queries Db *database.Queries
dto *dto.DtoClient dto *dto.DtoClient
//ctx *context.Context config services.Configs
sqlConnection *sql.DB
} }
const ( const (
@ -39,11 +40,12 @@ var (
ErrUnableToConvertToJson string = "Unable to convert to json" ErrUnableToConvertToJson string = "Unable to convert to json"
) )
func NewServer(ctx context.Context, db *database.Queries) *Handler { func NewServer(ctx context.Context, db *database.Queries, configs services.Configs, conn *sql.DB) *Handler {
s := &Handler{ s := &Handler{
//ctx: &ctx,
Db: db, Db: db,
dto: dto.NewDtoClient(db), dto: dto.NewDtoClient(db),
config: configs,
sqlConnection: conn,
} }
db, err := openDatabase(ctx) db, err := openDatabase(ctx)
@ -137,15 +139,3 @@ func (s *Handler) WriteError(c echo.Context, errMessage string, HttpStatusCode i
Message: errMessage, Message: errMessage,
}) })
} }
//func (s *Handler) WriteJson(w http.ResponseWriter, model interface{}) {
// w.Header().Set(HeaderContentType, ApplicationJson)
//
// bres, err := json.Marshal(model)
// if err != nil {
// s.WriteError(w, err.Error(), http.StatusInternalServerError)
// return
// }
//
// w.Write(bres)
//}