mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-08-21 15:11:48 +02:00
* Due date time of issues and milestones is set to 23:59:59 * Add docs * make gen swagger * fix swagger gen
This commit is contained in:
parent
63bd1b9203
commit
4c52858c39
|
@ -9,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
|
@ -144,7 +145,7 @@ func GetIssue(ctx *context.APIContext) {
|
|||
func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
|
||||
// swagger:operation POST /repos/{owner}/{repo}/issues issue issueCreateIssue
|
||||
// ---
|
||||
// summary: Create an issue
|
||||
// summary: Create an issue. If using deadline only the date will be taken into account, and time of day ignored.
|
||||
// consumes:
|
||||
// - application/json
|
||||
// produces:
|
||||
|
@ -236,7 +237,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
|
|||
func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
|
||||
// swagger:operation PATCH /repos/{owner}/{repo}/issues/{index} issue issueEditIssue
|
||||
// ---
|
||||
// summary: Edit an issue
|
||||
// summary: Edit an issue. If using deadline only the date will be taken into account, and time of day ignored.
|
||||
// consumes:
|
||||
// - application/json
|
||||
// produces:
|
||||
|
@ -360,7 +361,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
|
|||
func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
|
||||
// swagger:operation POST /repos/{owner}/{repo}/issues/{index}/deadline issue issueEditIssueDeadline
|
||||
// ---
|
||||
// summary: Set an issue deadline. If set to null, the deadline is deleted.
|
||||
// summary: Set an issue deadline. If set to null, the deadline is deleted. If using deadline only the date will be taken into account, and time of day ignored.
|
||||
// consumes:
|
||||
// - application/json
|
||||
// produces:
|
||||
|
@ -410,8 +411,11 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
|
|||
}
|
||||
|
||||
var deadlineUnix util.TimeStamp
|
||||
var deadline time.Time
|
||||
if form.Deadline != nil && !form.Deadline.IsZero() {
|
||||
deadlineUnix = util.TimeStamp(form.Deadline.Unix())
|
||||
deadline = time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
|
||||
23, 59, 59, 0, form.Deadline.Location())
|
||||
deadlineUnix = util.TimeStamp(deadline.Unix())
|
||||
}
|
||||
|
||||
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
|
||||
|
@ -419,5 +423,5 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
|
|||
return
|
||||
}
|
||||
|
||||
ctx.JSON(201, api.IssueDeadline{Deadline: form.Deadline})
|
||||
ctx.JSON(201, api.IssueDeadline{Deadline: &deadline})
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ func NewMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) {
|
|||
return
|
||||
}
|
||||
|
||||
deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, deadline.Location())
|
||||
if err = models.NewMilestone(&models.Milestone{
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
Name: form.Title,
|
||||
|
@ -175,6 +176,7 @@ func EditMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) {
|
|||
return
|
||||
}
|
||||
|
||||
deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, deadline.Location())
|
||||
m, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
|
||||
if err != nil {
|
||||
if models.IsErrMilestoneNotExist(err) {
|
||||
|
|
|
@ -1967,7 +1967,7 @@
|
|||
"tags": [
|
||||
"issue"
|
||||
],
|
||||
"summary": "Create an issue",
|
||||
"summary": "Create an issue. If using deadline only the date will be taken into account, and time of day ignored.",
|
||||
"operationId": "issueCreateIssue",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -2271,7 +2271,7 @@
|
|||
"tags": [
|
||||
"issue"
|
||||
],
|
||||
"summary": "Edit an issue",
|
||||
"summary": "Edit an issue. If using deadline only the date will be taken into account, and time of day ignored.",
|
||||
"operationId": "issueEditIssue",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -2521,7 +2521,7 @@
|
|||
"tags": [
|
||||
"issue"
|
||||
],
|
||||
"summary": "Set an issue deadline. If set to null, the deadline is deleted.",
|
||||
"summary": "Set an issue deadline. If set to null, the deadline is deleted. If using deadline only the date will be taken into account, and time of day ignored.",
|
||||
"operationId": "issueEditIssueDeadline",
|
||||
"parameters": [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue