benzend / goalboard-collab

0 stars 1 forks source link

Refactored how we currently generate and get user ID'S #6

Closed GwartneyDev closed 6 months ago

GwartneyDev commented 7 months ago

So I currently went ahead and did some refactoring, as I wanted to make sure if were using helper classes with interfaces ect we try to stick to also using get and set methods.

Which while it was pretty much already there with the IDmapper method I felt that what I put possibly reads a bit better. And is more controllable input wise since yours was more dynamic with what it was taking in and out in the helper class it self. But pretty much when you look into what I have placed. You will notice it does the exact same thing just I stuck to more of the strict get set oop concept here.

However you will notice here I did leave this Default struct 
func (g *Goal) Default(id string) *Goal {
    return &Goal{
        ID:        id,
        name:      "somerandomname",
        target:    60000,
        targetPer: "day",

        createdAt: time.Now().String(),
        updatedAt: time.Now().String(),
    }
}

As well as this override method.  
 func NewDefault() *Goal {
    goal := new(Goal)
    return goal.Default("default_id")
}

As I just needed a stoping point for the night. As I was testing a few things with your original code ect. But right now was just more focused on trying to start with dynamic ID ect. I will come back to this tomorrow sometime but let me know what you think and where it needs to start to get refactored again ect. Or if we should just keep the original you had?