-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use api.TrackedTime in API #2807
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2807 +/- ##
==========================================
- Coverage 26.85% 26.84% -0.02%
==========================================
Files 89 89
Lines 17600 17608 +8
==========================================
Hits 4727 4727
- Misses 12187 12195 +8
Partials 686 686
Continue to review full report at Codecov.
|
routers/api/v1/convert/convert.go
Outdated
@@ -190,3 +190,14 @@ func ToTeam(team *models.Team) *api.Team { | |||
Permission: team.Authorize.String(), | |||
} | |||
} | |||
|
|||
// ToTrackedTime convert models.TrackedTime to api.TrackedTime | |||
func ToTrackedTime(trackedTime *models.TrackedTime) *api.TrackedTime { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this better would be as model method APIFormat() like this:
Line 268 in aa962de
func (issue *Issue) APIFormat() *api.Issue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lafriks Done. Out of curiosity, why do you prefer a TrackedTime.APIFormat()
method to a convert.ToTrackedTeam
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ethantkoenig it's just more straightforward and when just converting model to api type (1:1) I think there is no need for special function
@@ -10,6 +10,14 @@ import ( | |||
api "code.gitea.io/sdk/gitea" | |||
) | |||
|
|||
func convertTrackedTimes(trackedTimes []*models.TrackedTime) []*api.TrackedTime { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convertTrackedTimes
should also probably more specific for example convertTrackedTimesToAPIFormat
otherwise it's hard to understand just from name what it does acutally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to trackedTimesToAPIFormat
LGTM |
LGTM |
Do you regenerated swagger? |
@JonasFranzDEV I think this is only a refactor. It's no need. |
Use
api.TrackedTime
instead ofmodels.TrackedTime
in responses from time-tracking API endpoints.cc @JonasFranzDEV