Naming clear
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
@@ -20,39 +21,6 @@ type BookingController struct {
|
|||||||
|
|
||||||
var BookingExample booking.Booking
|
var BookingExample booking.Booking
|
||||||
|
|
||||||
// @Title Search
|
|
||||||
// @Description search bookings by execution
|
|
||||||
// @Param id path string true "id execution"
|
|
||||||
// @Param is_draft query string false "draft wished"
|
|
||||||
// @Param offset query string false
|
|
||||||
// @Param limit query string false
|
|
||||||
// @Success 200 {workspace} models.workspace
|
|
||||||
// @router /search/execution/:id [get]
|
|
||||||
func (o *BookingController) ExecutionSearch() {
|
|
||||||
/*
|
|
||||||
* This is a sample of how to use the search function
|
|
||||||
* The search function is used to search for data in the database
|
|
||||||
* The search function takes in a filter and a data type
|
|
||||||
* The filter is a struct that contains the search parameters
|
|
||||||
* The data type is an enum that specifies the type of data to search for
|
|
||||||
* The search function returns a list of data that matches the filter
|
|
||||||
* The data is then returned as a json object
|
|
||||||
*/
|
|
||||||
// store and return Id or post with UUID
|
|
||||||
user, peerID, groups := oclib.ExtractTokenInfo(*o.Ctx.Request)
|
|
||||||
id := o.Ctx.Input.Param(":id")
|
|
||||||
isDraft := o.Ctx.Input.Query("is_draft")
|
|
||||||
offset, _ := strconv.Atoi(o.Ctx.Input.Query("offset"))
|
|
||||||
limit, _ := strconv.Atoi(o.Ctx.Input.Query("limit"))
|
|
||||||
f := dbs.Filters{
|
|
||||||
Or: map[string][]dbs.Filter{ // filter by name if no filters are provided
|
|
||||||
"execution_id": {{Operator: dbs.EQUAL.String(), Value: id}},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).Search(&f, "", isDraft == "true", int64(offset), int64(limit))
|
|
||||||
o.ServeJSON()
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title Search
|
// @Title Search
|
||||||
// @Description search bookings
|
// @Description search bookings
|
||||||
// @Param start_date path string true "the word search you want to get"
|
// @Param start_date path string true "the word search you want to get"
|
||||||
@@ -63,6 +31,7 @@ func (o *BookingController) ExecutionSearch() {
|
|||||||
// @Success 200 {workspace} models.workspace
|
// @Success 200 {workspace} models.workspace
|
||||||
// @router /search/:start_date/:end_date [get]
|
// @router /search/:start_date/:end_date [get]
|
||||||
func (o *BookingController) Search() {
|
func (o *BookingController) Search() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a sample of how to use the search function
|
* This is a sample of how to use the search function
|
||||||
* The search function is used to search for data in the database
|
* The search function is used to search for data in the database
|
||||||
@@ -81,9 +50,10 @@ func (o *BookingController) Search() {
|
|||||||
isDraft := o.Ctx.Input.Query("is_draft")
|
isDraft := o.Ctx.Input.Query("is_draft")
|
||||||
sd := primitive.NewDateTimeFromTime(start_date)
|
sd := primitive.NewDateTimeFromTime(start_date)
|
||||||
ed := primitive.NewDateTimeFromTime(end_date)
|
ed := primitive.NewDateTimeFromTime(end_date)
|
||||||
|
fmt.Println("SEARCH START END", start_date, end_date)
|
||||||
f := dbs.Filters{
|
f := dbs.Filters{
|
||||||
And: map[string][]dbs.Filter{
|
And: map[string][]dbs.Filter{
|
||||||
"execution_date": {{Operator: "gte", Value: sd}, {Operator: "lte", Value: ed}},
|
"expected_start_date": {{Operator: "gte", Value: sd}, {Operator: "lte", Value: ed}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).Search(&f, "", isDraft == "true", int64(offset), int64(limit))
|
o.Data["json"] = oclib.NewRequest(oclib.LibDataEnum(oclib.BOOKING), user, peerID, groups, nil).Search(&f, "", isDraft == "true", int64(offset), int64(limit))
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module oc-scheduler
|
|||||||
go 1.25.0
|
go 1.25.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260407090927-6fe91eda875d
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260408134044-284533ad1d7b
|
||||||
github.com/beego/beego/v2 v2.3.8
|
github.com/beego/beego/v2 v2.3.8
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/robfig/cron v1.2.0
|
github.com/robfig/cron v1.2.0
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -10,6 +10,8 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20260407090336-526eaef33aa1 h1:uq6ZAHAqKVF9X
|
|||||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260407090336-526eaef33aa1/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA=
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260407090336-526eaef33aa1/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA=
|
||||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260407090927-6fe91eda875d h1:54Vl14gurwAkmZEaWZKUM5eDZfB7MF/fzWjibWLQljE=
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260407090927-6fe91eda875d h1:54Vl14gurwAkmZEaWZKUM5eDZfB7MF/fzWjibWLQljE=
|
||||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260407090927-6fe91eda875d/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA=
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260407090927-6fe91eda875d/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260408134044-284533ad1d7b h1:mOU+tc87/KEQgFmw1RcQ9E9Rbz8Q2jLOh5Cpu6po9Ww=
|
||||||
|
cloud.o-forge.io/core/oc-lib v0.0.0-20260408134044-284533ad1d7b/go.mod h1:+ENuvBfZdESSvecoqGY/wSvRlT3vinEolxKgwbOhUpA=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
|
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
|
||||||
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
|
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ func (ws *WorkflowSchedule) GenerateExecutions(wf *workflow.Workflow, isPreempti
|
|||||||
obj := &workflow_execution.WorkflowExecution{
|
obj := &workflow_execution.WorkflowExecution{
|
||||||
AbstractObject: utils.AbstractObject{
|
AbstractObject: utils.AbstractObject{
|
||||||
UUID: uuid.New().String(),
|
UUID: uuid.New().String(),
|
||||||
Name: wf.Name + "_execution_" + date.Start.String(),
|
Name: wf.Name + " execution " + date.Start.Format("2006-01-02 15:04"),
|
||||||
},
|
},
|
||||||
Priority: 1,
|
Priority: 1,
|
||||||
ExecutionsID: ws.UUID,
|
ExecutionsID: ws.UUID,
|
||||||
|
|||||||
BIN
oc-scheduler
BIN
oc-scheduler
Binary file not shown.
@@ -34,15 +34,6 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-scheduler/controllers:BookingController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:BookingController"],
|
|
||||||
beego.ControllerComments{
|
|
||||||
Method: "ExecutionSearch",
|
|
||||||
Router: `/search/execution/:id`,
|
|
||||||
AllowHTTPMethods: []string{"get"},
|
|
||||||
MethodParams: param.Make(),
|
|
||||||
Filters: nil,
|
|
||||||
Params: nil})
|
|
||||||
|
|
||||||
beego.GlobalControllerRouter["oc-scheduler/controllers:ExecutionVerificationController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:ExecutionVerificationController"],
|
beego.GlobalControllerRouter["oc-scheduler/controllers:ExecutionVerificationController"] = append(beego.GlobalControllerRouter["oc-scheduler/controllers:ExecutionVerificationController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetAll",
|
Method: "GetAll",
|
||||||
|
|||||||
@@ -28,6 +28,18 @@
|
|||||||
"name": "is_draft",
|
"name": "is_draft",
|
||||||
"description": "draft wished",
|
"description": "draft wished",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "offset",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -37,35 +49,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/booking/search/execution/{id}": {
|
|
||||||
"get": {
|
|
||||||
"tags": [
|
|
||||||
"booking"
|
|
||||||
],
|
|
||||||
"description": "search bookings by execution\n\u003cbr\u003e",
|
|
||||||
"operationId": "BookingController.Search",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"in": "path",
|
|
||||||
"name": "id",
|
|
||||||
"description": "id execution",
|
|
||||||
"required": true,
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"in": "query",
|
|
||||||
"name": "is_draft",
|
|
||||||
"description": "draft wished",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "{workspace} models.workspace"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/booking/search/{start_date}/{end_date}": {
|
"/booking/search/{start_date}/{end_date}": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -93,6 +76,18 @@
|
|||||||
"name": "is_draft",
|
"name": "is_draft",
|
||||||
"description": "draft wished",
|
"description": "draft wished",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "offset",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -138,6 +133,18 @@
|
|||||||
"name": "is_draft",
|
"name": "is_draft",
|
||||||
"description": "draft wished",
|
"description": "draft wished",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "offset",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -167,6 +174,18 @@
|
|||||||
"name": "is_draft",
|
"name": "is_draft",
|
||||||
"description": "draft wished",
|
"description": "draft wished",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "offset",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -203,6 +222,18 @@
|
|||||||
"name": "is_draft",
|
"name": "is_draft",
|
||||||
"description": "draft wished",
|
"description": "draft wished",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "offset",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -274,6 +305,18 @@
|
|||||||
"description": "id execution",
|
"description": "id execution",
|
||||||
"required": true,
|
"required": true,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "offset",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -296,6 +339,18 @@
|
|||||||
"name": "is_draft",
|
"name": "is_draft",
|
||||||
"description": "draft wished",
|
"description": "draft wished",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "offset",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "limit",
|
||||||
|
"description": "false",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ paths:
|
|||||||
name: is_draft
|
name: is_draft
|
||||||
description: draft wished
|
description: draft wished
|
||||||
type: string
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: offset
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: limit
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{booking} models.booking'
|
description: '{booking} models.booking'
|
||||||
@@ -87,26 +95,13 @@ paths:
|
|||||||
name: is_draft
|
name: is_draft
|
||||||
description: draft wished
|
description: draft wished
|
||||||
type: string
|
type: string
|
||||||
responses:
|
- in: query
|
||||||
"200":
|
name: offset
|
||||||
description: '{workspace} models.workspace'
|
description: "false"
|
||||||
/booking/search/execution/{id}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- booking
|
|
||||||
description: |-
|
|
||||||
search bookings by execution
|
|
||||||
<br>
|
|
||||||
operationId: BookingController.Search
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: id
|
|
||||||
description: id execution
|
|
||||||
required: true
|
|
||||||
type: string
|
type: string
|
||||||
- in: query
|
- in: query
|
||||||
name: is_draft
|
name: limit
|
||||||
description: draft wished
|
description: "false"
|
||||||
type: string
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
@@ -124,6 +119,14 @@ paths:
|
|||||||
name: is_draft
|
name: is_draft
|
||||||
description: draft wished
|
description: draft wished
|
||||||
type: string
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: offset
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: limit
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{workflow} models.workflow'
|
description: '{workflow} models.workflow'
|
||||||
@@ -162,6 +165,14 @@ paths:
|
|||||||
name: is_draft
|
name: is_draft
|
||||||
description: draft wished
|
description: draft wished
|
||||||
type: string
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: offset
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: limit
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{compute} models.compute'
|
description: '{compute} models.compute'
|
||||||
@@ -188,6 +199,14 @@ paths:
|
|||||||
name: is_draft
|
name: is_draft
|
||||||
description: draft wished
|
description: draft wished
|
||||||
type: string
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: offset
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: limit
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{workspace} models.workspace'
|
description: '{workspace} models.workspace'
|
||||||
@@ -223,6 +242,14 @@ paths:
|
|||||||
description: id execution
|
description: id execution
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: offset
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: limit
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{workspace} models.workspace'
|
description: '{workspace} models.workspace'
|
||||||
@@ -239,6 +266,14 @@ paths:
|
|||||||
name: is_draft
|
name: is_draft
|
||||||
description: draft wished
|
description: draft wished
|
||||||
type: string
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: offset
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
|
- in: query
|
||||||
|
name: limit
|
||||||
|
description: "false"
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{booking} models.booking'
|
description: '{booking} models.booking'
|
||||||
|
|||||||
Reference in New Issue
Block a user