mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-04 23:31:05 +01:00
Add project.type
Add response scheme when creating a project Add body to project update Fix create/update project not saving some fields. Add demo flag to Project Request
This commit is contained in:
parent
7681dfbf0b
commit
c38dbca84e
29
api-docs.yml
29
api-docs.yml
@ -136,7 +136,7 @@ definitions:
|
|||||||
|
|
||||||
ProjectBackup:
|
ProjectBackup:
|
||||||
type: object
|
type: object
|
||||||
example: {"meta":{"name":"homelab","alert":true,"alert_chat":"Test","max_parallel_tasks":0},"templates":[{"inventory":"Build","repository":"Demo","environment":"Empty","name":"Build","playbook":"build.yml","arguments":"[]","allow_override_args_in_task":false,"description":"Build Job","vault_key":null,"type":"build","start_version":"1.0.0","build_template":null,"view":"Build","autorun":false,"survey_vars":[],"suppress_success_alerts":false,"cron":"* * * * *"}],"repositories":[{"name":"Demo","git_url":"https://github.com/semaphoreui/demo-project.git","git_branch":"main","ssh_key":"None"}],"keys":[{"name":"None","type":"none"},{"name":"Vault Password","type":"login_password"}],"views":[{"title":"Build","position":0}],"inventories":[{"name":"Build","inventory":"","ssh_key":"None","become_key":"None","type":"static"},{"name":"Dev","inventory":"","ssh_key":"None","become_key":"None","type":"file"},{"name":"Prod","inventory":"","ssh_key":"None","become_key":"None","type":"file"}],"environments":[{"name":"Empty","password":null,"json":"{}","env":null}]}
|
example: {"meta":{"name":"homelab","alert":true,"alert_chat":"Test","max_parallel_tasks":0,"type":null},"templates":[{"inventory":"Build","repository":"Demo","environment":"Empty","name":"Build","playbook":"build.yml","arguments":"[]","allow_override_args_in_task":false,"description":"Build Job","vault_key":null,"type":"build","start_version":"1.0.0","build_template":null,"view":"Build","autorun":false,"survey_vars":[],"suppress_success_alerts":false,"cron":"* * * * *"}],"repositories":[{"name":"Demo","git_url":"https://github.com/semaphoreui/demo-project.git","git_branch":"main","ssh_key":"None"}],"keys":[{"name":"None","type":"none"},{"name":"Vault Password","type":"login_password"}],"views":[{"title":"Build","position":0}],"inventories":[{"name":"Build","inventory":"","ssh_key":"None","become_key":"None","type":"static"},{"name":"Dev","inventory":"","ssh_key":"None","become_key":"None","type":"file"},{"name":"Prod","inventory":"","ssh_key":"None","become_key":"None","type":"file"}],"environments":[{"name":"Empty","password":null,"json":"{}","env":null}]}
|
||||||
properties:
|
properties:
|
||||||
meta:
|
meta:
|
||||||
type: object
|
type: object
|
||||||
@ -152,6 +152,10 @@ definitions:
|
|||||||
max_parallel_tasks:
|
max_parallel_tasks:
|
||||||
type: integer
|
type: integer
|
||||||
minimum: 0
|
minimum: 0
|
||||||
|
type:
|
||||||
|
type:
|
||||||
|
- string
|
||||||
|
- 'null'
|
||||||
templates:
|
templates:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@ -304,6 +308,13 @@ definitions:
|
|||||||
max_parallel_tasks:
|
max_parallel_tasks:
|
||||||
type: integer
|
type: integer
|
||||||
minimum: 0
|
minimum: 0
|
||||||
|
type:
|
||||||
|
type:
|
||||||
|
- string
|
||||||
|
- 'null'
|
||||||
|
demo:
|
||||||
|
description: Create Demo project resources?
|
||||||
|
type: boolean
|
||||||
Project:
|
Project:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
@ -326,6 +337,10 @@ definitions:
|
|||||||
max_parallel_tasks:
|
max_parallel_tasks:
|
||||||
type: integer
|
type: integer
|
||||||
minimum: 0
|
minimum: 0
|
||||||
|
type:
|
||||||
|
type:
|
||||||
|
- string
|
||||||
|
- 'null'
|
||||||
|
|
||||||
AccessKeyRequest:
|
AccessKeyRequest:
|
||||||
type: object
|
type: object
|
||||||
@ -1283,6 +1298,8 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
201:
|
201:
|
||||||
description: Created project
|
description: Created project
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Project"
|
||||||
/projects/restore:
|
/projects/restore:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@ -1344,10 +1361,12 @@ paths:
|
|||||||
in: body
|
in: body
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: object
|
allOf:
|
||||||
properties:
|
- $ref: '#/definitions/ProjectRequest'
|
||||||
name:
|
- properties:
|
||||||
type: string
|
id:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
responses:
|
responses:
|
||||||
204:
|
204:
|
||||||
description: Project saved
|
description: Project saved
|
||||||
|
@ -11,8 +11,8 @@ func (d *SqlDb) CreateProject(project db.Project) (newProject db.Project, err er
|
|||||||
|
|
||||||
insertId, err := d.insert(
|
insertId, err := d.insert(
|
||||||
"id",
|
"id",
|
||||||
"insert into project(name, created, type) values (?, ?, ?)",
|
"insert into project(name, created, type, alert, alert_chat, max_parallel_tasks) values (?, ?, ?, ?, ?, ?)",
|
||||||
project.Name, project.Created, project.Type)
|
project.Name, project.Created, project.Type, project.Alert, project.AlertChat, project.MaxParallelTasks)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -110,11 +110,12 @@ func (d *SqlDb) DeleteProject(projectID int) error {
|
|||||||
|
|
||||||
func (d *SqlDb) UpdateProject(project db.Project) error {
|
func (d *SqlDb) UpdateProject(project db.Project) error {
|
||||||
_, err := d.exec(
|
_, err := d.exec(
|
||||||
"update project set name=?, alert=?, alert_chat=?, max_parallel_tasks=? where id=?",
|
"update project set name=?, alert=?, alert_chat=?, max_parallel_tasks=?, type=? where id=?",
|
||||||
project.Name,
|
project.Name,
|
||||||
project.Alert,
|
project.Alert,
|
||||||
project.AlertChat,
|
project.AlertChat,
|
||||||
project.MaxParallelTasks,
|
project.MaxParallelTasks,
|
||||||
|
project.Type,
|
||||||
project.ID)
|
project.ID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user