Skip to content
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

Merged
merged 4 commits into from
Nov 1, 2017
Merged

Conversation

ethantkoenig
Copy link
Member

Use api.TrackedTime instead of models.TrackedTime in responses from time-tracking API endpoints.

cc @JonasFranzDEV

@codecov-io
Copy link

codecov-io commented Oct 31, 2017

Codecov Report

Merging #2807 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
models/issue_tracked_time.go 73.13% <0%> (-9.92%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e225497...0d2dca0. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 31, 2017
@@ -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 {
Copy link
Member

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:

func (issue *Issue) APIFormat() *api.Issue {

Copy link
Member Author

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?

Copy link
Member

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

@lunny lunny added this to the 1.4.0 milestone Oct 31, 2017
@@ -10,6 +10,14 @@ import (
api "code.gitea.io/sdk/gitea"
)

func convertTrackedTimes(trackedTimes []*models.TrackedTime) []*api.TrackedTime {
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to trackedTimesToAPIFormat

@lafriks lafriks added the modifies/api This PR adds API routes or modifies them label Oct 31, 2017
@lafriks lafriks modified the milestones: 1.4.0, 1.3.0 Oct 31, 2017
@lafriks
Copy link
Member

lafriks commented Oct 31, 2017

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 31, 2017
@lunny
Copy link
Member

lunny commented Nov 1, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 1, 2017
@lunny lunny merged commit e6a97b6 into go-gitea:master Nov 1, 2017
@jonasfranz
Copy link
Member

Do you regenerated swagger?

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Nov 1, 2017
@lunny
Copy link
Member

lunny commented Nov 1, 2017

@JonasFranzDEV I think this is only a refactor. It's no need.

@ethantkoenig ethantkoenig deleted the fix/track_time_api branch December 18, 2017 06:13
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants