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

feat: api endpoints for projects #28111

Open
wants to merge 51 commits into
base: main
Choose a base branch
from

Conversation

dineshsalunke
Copy link

Fixes #14299

My earlier PR #20208 went too long and became messy, so I am closing that one and will be splitting the work in smaller chunks.

This PR includes all the endpoints for the Projects

  • POST /user/projects
  • POST /orgs/{org}/projects
  • POST /repos/{owner}/{repo}/projects
  • GET /user/projects
  • GET /orgs/{org}/projects
  • GET /repos/{owner}/{repo}/projects
  • GET /projects/{id}
  • PATCH /projects/{id}
  • DELETE /projects/{id}

For all the endpoints related to Boards I will be raising another PR for the same.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 18, 2023
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 18, 2023
@github-actions github-actions bot added the modifies/api This PR adds API routes or modifies them label Nov 18, 2023
@denyskon
Copy link
Member

@dineshsalunke Is the PR still WIP or is it ready for review?

@dineshsalunke
Copy link
Author

@denyskon this one is ready for review

@GamerGirlandCo
Copy link

looks good to me!

@lunny lunny added this to the 1.22.0 milestone Jan 12, 2024
@denyskon denyskon added the giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main label Jan 15, 2024
@GiteaBot GiteaBot removed the giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main label Jan 15, 2024
@denyskon
Copy link
Member

@dineshsalunke I see a lot of unrelated formatting changes, maybe originating from your editor formatter or similar. Could you revert them?

@dineshsalunke
Copy link
Author

@denyskon I have fixed the golines formatting and pushed.
as for the indentation I am not sure where it is coming from, since my editor is showing it correctly.

I will still check on it and get back

@denyskon
Copy link
Member

@dineshsalunke Thank you, however unfortunately some are still remaining in routers/api/v1/api.go.....

@denyskon
Copy link
Member

Also, some methods seem to have broken when updating to main. Could you take a look please?

@denyskon denyskon requested review from lunny and 6543 February 5, 2024 20:38
@lunny
Copy link
Member

lunny commented Feb 6, 2024

Every time I take a look at project permissions, I get confused more and more.... What happens if a user belongs to a team having write permissions to issues, but read permissions to projects? Need some more time to check.

@lunny @6543 You've been involved in reviewing the old PR. What do you think?

I think we need a project scope.

If one can write issues, he can delete/edit issues/comments. If he has read permission of project, it can visit project columns UI. I don't think they are conflicted.

@dineshsalunke
Copy link
Author

👍 will update the PR accordingly.

}
return
}
if project.Title != form.Title {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't form Title and Description be *string and be updated only when provided? At least this is how normaly PATCH works. And I don't see any point in comparing with existing project values

Copy link
Author

Choose a reason for hiding this comment

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

I agree with you on the first point to check if the title or description is present,

As for the second point, the reason behind comparing with existing value is that if there is some logic somewhere down the code which reacts to the changes and if there is logic of diffing for changes then setting the value here blindly would cause unwanted side effects.

I might be thinking too much on this, but its practice i picked up from other places where this was an issue.

@lunny lunny modified the milestones: 1.22.0, 1.23.0 Mar 4, 2024
@xhorntail
Copy link

There's a large chance that I've overlooked it, but after a quick once-over of the file changes, I don't see a way to attach a ticket to a project over the API? Neither at creation, or thereafter.

I just ran into this today while I was working on some personal projects, which brought me here, so I thought I'd mention it just in case it was overlooked.

Thanks for all the great work! Love the project!

@denyskon denyskon mentioned this pull request Apr 5, 2024
13 tasks
@lunny
Copy link
Member

lunny commented Sep 13, 2024

If you don't mind, I think maintainers can help update the pull request.

Closed: project.ClosedDateUnix.AsTime(),
}

_ = project.LoadRepo(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

The return error should be handled.

@dineshsalunke
Copy link
Author

@lunny I noticed that the board related models have been renamed to Column and Template, so do we wanna update all the properties in the payloads and responses accordingly ?

If we change them wouldn't that be a breaking change

@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Sep 22, 2024
@lunny
Copy link
Member

lunny commented Sep 22, 2024

@lunny I noticed that the board related models have been renamed to Column and Template, so do we wanna update all the properties in the payloads and responses accordingly ?

If we change them wouldn't that be a breaking change

At the moment, I prefer to change the names as more as possible but keeping compatible. You can find I didn't change the table name and some places in my original PR.

// required:true
Title string `json:"title" binding:"Required"`
// required:true
BoardType uint8 `json:"board_type"`
Copy link
Member

Choose a reason for hiding this comment

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

TemplateType to align with other places?

m.Combo("/{id}").Get(projects.GetProject).
Patch(bind(api.UpdateProjectPayload{}), projects.UpdateProject).
Delete(projects.DeleteProject)
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryIssue), reqToken())
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 we need a new token scope AccessTokenScopeCategoryProject.

@lunny lunny modified the milestones: 1.23.0, 1.24.0 Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. topic/projects type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] API for projects
7 participants