HI [~austincunningham],
The name of the method is GetAppByID if you need return just actives one in the REST endpoint and you will change the repo method to do it then I'd like to suggest you also change the creating a new one with another name for something that which makes it clear.
*Why I am saying that?*
Because the project may have or will have services that need to use GetAppByID in order to get the details to do further operations. For Example, the service has the ID but need to obtain the APP_ID. Also to check if the app exists or not before creating/update someone and in this scenario will be required to check all and not just the active.
So, For example. It will be used in the idea here binding to check if the app exists or not.
{code:java} func (a *appsService) BindingAppByApp(appId, name string) error {
// Check if exist app, err := a.repository.GetAppByAppID(appId)
// If it is new then create an app if err != nil && err == models.ErrNotFound { id := helpers.GetUUID() return a.repository.CreateApp(id, appId, name) }
if err != nil { return err }
// if is deleted so just highlighted these above scenarios for you beware when you will make this change reactive the existent app return a . repository.UnDeleteAppByAppID(app.AppID) } {code}
I hope that it makes sense.
c/c @david ff |
|