2017-11-13 08:02:25 +01:00
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
2022-11-27 19:20:29 +01:00
|
|
|
// SPDX-License-Identifier: MIT
|
2017-11-13 08:02:25 +01:00
|
|
|
|
|
|
|
package swagger
|
|
|
|
|
|
|
|
import (
|
2019-05-11 12:21:34 +02:00
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
2021-04-06 21:44:05 +02:00
|
|
|
"code.gitea.io/gitea/services/forms"
|
2017-11-13 08:02:25 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// not actually a response, just a hack to get go-swagger to include definitions
|
|
|
|
// of the various XYZOption structs
|
|
|
|
|
2018-05-31 13:13:55 +02:00
|
|
|
// parameterBodies
|
2017-11-13 08:02:25 +01:00
|
|
|
// swagger:response parameterBodies
|
|
|
|
type swaggerParameterBodies struct {
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
AddCollaboratorOption api.AddCollaboratorOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateEmailOption api.CreateEmailOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
DeleteEmailOption api.DeleteEmailOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateHookOption api.CreateHookOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditHookOption api.EditHookOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2019-04-17 07:31:08 +02:00
|
|
|
// in:body
|
|
|
|
EditGitHookOption api.EditGitHookOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateIssueOption api.CreateIssueOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditIssueOption api.EditIssueOption
|
2018-07-16 14:43:00 +02:00
|
|
|
// in:body
|
|
|
|
EditDeadlineOption api.EditDeadlineOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateIssueCommentOption api.CreateIssueCommentOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditIssueCommentOption api.EditIssueCommentOption
|
2023-03-28 19:23:25 +02:00
|
|
|
// in:body
|
|
|
|
IssueMeta api.IssueMeta
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
IssueLabelsOption api.IssueLabelsOption
|
|
|
|
|
[v1.21] [FEAT] allow setting the update date on issues and comments
This field adds the possibility to set the update date when modifying
an issue through the API.
A 'NoAutoDate' in-memory field is added in the Issue struct.
If the update_at field is set, NoAutoDate is set to true and the
Issue's UpdatedUnix field is filled.
That information is passed down to the functions that actually updates
the database, which have been modified to not auto update dates if
requested.
A guard is added to the 'EditIssue' API call, to checks that the
udpate_at date is between the issue's creation date and the current
date (to avoid 'malicious' changes). It also limits the new feature
to project's owners and admins.
(cherry picked from commit c524d33402c76bc4cccea2806f289e08a009baae)
Add a SetIssueUpdateDate() function in services/issue.go
That function is used by some API calls to set the NoAutoDate and
UpdatedUnix fields of an Issue if an updated_at date is provided.
(cherry picked from commit f061caa6555e0c9e922ee1e73dd2e4337360e9fe)
Add an updated_at field to the API calls related to Issue's Labels.
The update date is applied to the issue's comment created to inform
about the modification of the issue's labels.
(cherry picked from commit ea36cf80f58f0ab20c565a8f5d063b90fd741f97)
Add an updated_at field to the API call for issue's attachment creation
The update date is applied to the issue's comment created to inform
about the modification of the issue's content, and is set as the
asset creation date.
(cherry picked from commit 96150971ca31b97e97e84d5f5eb95a177cc44e2e)
Checking Issue changes, with and without providing an updated_at date
Those unit tests are added:
- TestAPIEditIssueWithAutoDate
- TestAPIEditIssueWithNoAutoDate
- TestAPIAddIssueLabelsWithAutoDate
- TestAPIAddIssueLabelsWithNoAutoDate
- TestAPICreateIssueAttachmentWithAutoDate
- TestAPICreateIssueAttachmentWithNoAutoDate
(cherry picked from commit 4926a5d7a28581003545256632213bf4136b193d)
Add an updated_at field to the API call for issue's comment creation
The update date is used as the comment creation date, and is applied to
the issue as the update creation date.
(cherry picked from commit 76c8faecdc6cba48ca4fe07d1a916d1f1a4b37b4)
Add an updated_at field to the API call for issue's comment edition
The update date is used as the comment update date, and is applied to
the issue as an update date.
(cherry picked from commit cf787ad7fdb8e6273fdc35d7b5cc164b400207e9)
Add an updated_at field to the API call for comment's attachment creation
The update date is applied to the comment, and is set as the asset
creation date.
(cherry picked from commit 1e4ff424d39db7a4256cd9abf9c58b8d3e1b5c14)
Checking Comment changes, with and without providing an updated_at date
Those unit tests are added:
- TestAPICreateCommentWithAutoDate
- TestAPICreateCommentWithNoAutoDate
- TestAPIEditCommentWithAutoDate
- TestAPIEditCommentWithNoAutoDate
- TestAPICreateCommentAttachmentWithAutoDate
- TestAPICreateCommentAttachmentWithNoAutoDate
(cherry picked from commit da932152f1deb3039a399516a51c8b6757059c91)
Pettier code to set the update time of comments
Now uses sess.AllCols().NoAutoToime().SetExpr("updated_unix", ...)
XORM is smart enough to compose one single SQL UPDATE which all
columns + updated_unix.
(cherry picked from commit 1f6a42808dd739c0c2e49e6b7ae2967f120f43c2)
Issue edition: Keep the max of the milestone and issue update dates.
When editing an issue via the API, an updated_at date can be provided.
If the EditIssue call changes the issue's milestone, the milestone's
update date is to be changed accordingly, but only with a greater
value.
This ensures that a milestone's update date is the max of all issue's
update dates.
(cherry picked from commit 8f22ea182e6b49e933dc6534040160dd739ff18a)
Rewrite the 'AutoDate' tests using subtests
Also add a test to check the permissions to set a date, and a test
to check update dates on milestones.
The tests related to 'AutoDate' are:
- TestAPIEditIssueAutoDate
- TestAPIAddIssueLabelsAutoDate
- TestAPIEditIssueMilestoneAutoDate
- TestAPICreateIssueAttachmentAutoDate
- TestAPICreateCommentAutoDate
- TestAPIEditCommentWithDate
- TestAPICreateCommentAttachmentAutoDate
(cherry picked from commit 961fd13c551b3e50040acb7c914a00ead92de63f)
(cherry picked from commit d52f4eea44692ee773010cb66a69a603663947d5)
(cherry picked from commit 3540ea2a43155ca8cf5ab1a4a246babfb829db16)
Conflicts:
services/issue/issue.go
https://codeberg.org/forgejo/forgejo/pulls/1415
(cherry picked from commit 56720ade008c09122d825959171aa5346d645987)
Conflicts:
routers/api/v1/repo/issue_label.go
https://codeberg.org/forgejo/forgejo/pulls/1462
(cherry picked from commit 47c78927d6c7e7a50298fa67efad1e73723a0981)
(cherry picked from commit 2030f3b965cde401976821083c3250b404954ecc)
(cherry picked from commit f02aeb76981cd688ceaf6613f142a8a725be1437)
(cherry picked from commit 2e43e49961c1cd5791744fa4e7994ce929c31837)
(cherry picked from commit 3bfb6cc1c085a1ae11885d0eb138d7e977fa1a16)
2023-05-30 18:42:58 +02:00
|
|
|
// in:body
|
|
|
|
DeleteLabelsOption api.DeleteLabelsOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateKeyOption api.CreateKeyOption
|
|
|
|
|
2023-03-14 08:45:21 +01:00
|
|
|
// in:body
|
|
|
|
RenameUserOption api.RenameUserOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateLabelOption api.CreateLabelOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditLabelOption api.EditLabelOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2023-03-24 07:12:23 +01:00
|
|
|
// in:body
|
|
|
|
MarkupOption api.MarkupOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
MarkdownOption api.MarkdownOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateMilestoneOption api.CreateMilestoneOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditMilestoneOption api.EditMilestoneOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateOrgOption api.CreateOrgOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditOrgOption api.EditOrgOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreatePullRequestOption api.CreatePullRequestOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditPullRequestOption api.EditPullRequestOption
|
2019-02-08 09:08:38 +01:00
|
|
|
// in:body
|
2021-04-06 21:44:05 +02:00
|
|
|
MergePullRequestOption forms.MergePullRequestForm
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateReleaseOption api.CreateReleaseOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditReleaseOption api.EditReleaseOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateRepoOption api.CreateRepoOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2019-05-30 17:09:05 +02:00
|
|
|
EditRepoOption api.EditRepoOption
|
|
|
|
// in:body
|
2020-01-31 16:49:04 +01:00
|
|
|
TransferRepoOption api.TransferRepoOption
|
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateForkOption api.CreateForkOption
|
2021-07-05 17:29:08 +02:00
|
|
|
// in:body
|
|
|
|
GenerateRepoOption api.GenerateRepoOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateStatusOption api.CreateStatusOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateTeamOption api.CreateTeamOption
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditTeamOption api.EditTeamOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
AddTimeOption api.AddTimeOption
|
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2017-11-13 08:02:25 +01:00
|
|
|
CreateUserOption api.CreateUserOption
|
2019-04-17 18:06:35 +02:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
|
|
|
EditUserOption api.EditUserOption
|
2017-11-13 08:02:25 +01:00
|
|
|
|
2018-06-12 16:59:22 +02:00
|
|
|
// in:body
|
2018-03-06 02:22:16 +01:00
|
|
|
EditAttachmentOptions api.EditAttachmentOptions
|
2019-04-17 18:06:35 +02:00
|
|
|
|
2023-05-29 11:41:35 +02:00
|
|
|
// in:body
|
|
|
|
ChangeFilesOptions api.ChangeFilesOptions
|
|
|
|
|
2019-04-17 18:06:35 +02:00
|
|
|
// in:body
|
|
|
|
CreateFileOptions api.CreateFileOptions
|
|
|
|
|
|
|
|
// in:body
|
|
|
|
UpdateFileOptions api.UpdateFileOptions
|
|
|
|
|
|
|
|
// in:body
|
|
|
|
DeleteFileOptions api.DeleteFileOptions
|
2019-09-03 17:46:24 +02:00
|
|
|
|
2019-12-24 03:33:52 +01:00
|
|
|
// in:body
|
|
|
|
CommitDateOptions api.CommitDateOptions
|
|
|
|
|
2019-09-03 17:46:24 +02:00
|
|
|
// in:body
|
|
|
|
RepoTopicOptions api.RepoTopicOptions
|
2019-12-31 09:21:21 +01:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
EditReactionOption api.EditReactionOption
|
2020-02-13 00:19:35 +01:00
|
|
|
|
2020-05-29 20:16:20 +02:00
|
|
|
// in:body
|
|
|
|
CreateBranchRepoOption api.CreateBranchRepoOption
|
|
|
|
|
2020-02-13 00:19:35 +01:00
|
|
|
// in:body
|
|
|
|
CreateBranchProtectionOption api.CreateBranchProtectionOption
|
|
|
|
|
|
|
|
// in:body
|
|
|
|
EditBranchProtectionOption api.EditBranchProtectionOption
|
2020-02-29 07:19:32 +01:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
CreateOAuth2ApplicationOptions api.CreateOAuth2ApplicationOptions
|
2020-05-02 02:20:51 +02:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
CreatePullReviewOptions api.CreatePullReviewOptions
|
|
|
|
|
|
|
|
// in:body
|
|
|
|
CreatePullReviewComment api.CreatePullReviewComment
|
|
|
|
|
|
|
|
// in:body
|
|
|
|
SubmitPullReviewOptions api.SubmitPullReviewOptions
|
2020-09-11 00:29:19 +02:00
|
|
|
|
2021-02-11 18:32:25 +01:00
|
|
|
// in:body
|
|
|
|
DismissPullReviewOptions api.DismissPullReviewOptions
|
|
|
|
|
2020-09-11 00:29:19 +02:00
|
|
|
// in:body
|
|
|
|
MigrateRepoOptions api.MigrateRepoOptions
|
2020-10-20 20:18:25 +02:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
PullReviewRequestOptions api.PullReviewRequestOptions
|
2021-06-17 18:04:10 +02:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
CreateTagOption api.CreateTagOption
|
2021-06-23 21:58:44 +02:00
|
|
|
|
2021-08-01 22:44:15 +02:00
|
|
|
// in:body
|
|
|
|
CreateAccessTokenOption api.CreateAccessTokenOption
|
|
|
|
|
2021-06-23 21:58:44 +02:00
|
|
|
// in:body
|
|
|
|
UserSettingsOptions api.UserSettingsOptions
|
2021-10-25 05:43:40 +02:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
CreateWikiPageOptions api.CreateWikiPageOptions
|
2022-07-30 18:45:59 +02:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
CreatePushMirrorOption api.CreatePushMirrorOption
|
2023-06-30 01:22:55 +02:00
|
|
|
|
|
|
|
// in:body
|
|
|
|
UpdateUserAvatarOptions api.UpdateUserAvatarOption
|
|
|
|
|
|
|
|
// in:body
|
|
|
|
UpdateRepoAvatarOptions api.UpdateRepoAvatarOption
|
2023-08-22 05:20:34 +02:00
|
|
|
|
|
|
|
// in:body
|
2023-08-28 07:08:19 +02:00
|
|
|
CreateOrUpdateSecretOption api.CreateOrUpdateSecretOption
|
2017-11-13 08:02:25 +01:00
|
|
|
}
|