forked from Gitlink/gitea-1156
add:API /activity/project
This commit is contained in:
parent
a60ff19252
commit
a02afaf830
|
@ -603,6 +603,7 @@ func Routes() *web.Route {
|
|||
|
||||
m.Group("/activity", func() {
|
||||
m.Get("", report.GetActivity)
|
||||
m.Get("/project", report.GetActivityProject)
|
||||
})
|
||||
// Notifications
|
||||
m.Group("/notifications", func() {
|
||||
|
|
|
@ -47,6 +47,53 @@ func GetActivity(ctx *context.APIContext) {
|
|||
ctx.JSON(http.StatusOK, list)
|
||||
}
|
||||
|
||||
type PrjectDTO struct {
|
||||
Project interface{} `json:"project"`
|
||||
}
|
||||
|
||||
func GetActivityProject(ctx *context.APIContext) {
|
||||
// swagger:operation GET /activity/project activity project
|
||||
// ---
|
||||
// summary: Statistics of submitted data by project **
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: from
|
||||
// in: query
|
||||
// description: Query begin timestamp
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: to
|
||||
// in: query
|
||||
// description: Query end timestamp
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: top
|
||||
// in: query
|
||||
// description: Display the previous n records
|
||||
// type: integer
|
||||
// required: false
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PlatformDTO"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
opt := GetParamOption(ctx)
|
||||
if opt == nil {
|
||||
return
|
||||
}
|
||||
list, err := models.GetActivityProject(opt)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetActivityProject", err)
|
||||
return
|
||||
}
|
||||
data := PrjectDTO{
|
||||
Project: list,
|
||||
}
|
||||
ctx.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
||||
func GetParamOption(ctx *context.APIContext) (opt *models.GetGetActivityOptions) {
|
||||
Layout := "2006-01-02 15:04:05"
|
||||
//##top
|
||||
|
|
|
@ -57,6 +57,46 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/activity/project": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"activity"
|
||||
],
|
||||
"summary": "Statistics of submitted data by project **",
|
||||
"operationId": "project",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Query begin timestamp",
|
||||
"name": "from",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Query end timestamp",
|
||||
"name": "to",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Display the previous n records",
|
||||
"name": "top",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/PlatformDTO"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/admin/cron": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
|
Loading…
Reference in New Issue