golang-cafe / job-board

Golang Cafe - Go job board with no recruiters and clear salary ranges
https://golang.cafe
BSD 3-Clause "New" or "Revised" License
211 stars 51 forks source link

[FEATURE] refactor database.go to use repository pattern #12

Open ghost opened 3 years ago

ghost commented 3 years ago

currently all database logic resides inside a single file called database.go - we would want to have a better maintained structure by using repository pattern. for each object category we would have a repository that abstracts away the database layer. for example

current structure has pkg folder

we could have a structure like the following

internal/
  job/
    handlers.go
    repo.go
    errors.go
    models.go
    sql.go
  developerprofile/
    handlers.go
    repo.go
    errors.go
  ... 

this will make the project much easier to maintain

ferueda commented 2 years ago

Hey! This one looks fun, I'd love to help with it. Any recommendation for running the project locally?

ghost commented 2 years ago

thanks @ferueda please bear with me a day or two and I will try to put this together. it should be pretty straightforward I just have to create some database fixtures and migration scripts

ghost commented 2 years ago

@ferueda I have just added a setup guide with a minimal set of database fixtures so it's easy to run the app locally https://github.com/golang-cafe/golang.cafe/commit/0cce17821213d39e80ab9929da0f814bf3977a84

If you have any issues please let me know. You might need Docker installed and a recent Go installation.

ferueda commented 2 years ago

@pizzatarian thanks! I'll let you know how it goes

cristaloleg commented 1 year ago

Looks like this isssue can be closed.