Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(obligation_classifications): Add admin apis for creating, listing and deleting obligation classifications #92

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 180 additions & 7 deletions cmd/laas/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,159 @@ const docTemplate = `{
}
}
},
"/obligations/classifications": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Get all active obligation classifications from the service",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Obligations"
],
"summary": "Get all active obligation classifications",
"operationId": "GetAllObligationClassification",
"parameters": [
{
"type": "boolean",
"description": "Active obligation classification only",
"name": "active",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ObligationClassificationResponse"
}
},
"404": {
"description": "No obligation classifications in DB",
"schema": {
"$ref": "#/definitions/models.LicenseError"
}
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Create an obligation classification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Obligations"
],
"summary": "Create an obligation classification",
"operationId": "CreateObligationClassification",
"parameters": [
{
"description": "Obligation classification to create",
"name": "obligation_classification",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ObligationClassification"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/models.ObligationClassificationResponse"
}
},
"400": {
"description": "invalid json body",
"schema": {
"$ref": "#/definitions/models.LicenseError"
}
},
"409": {
"description": "obligation classification already exists",
"schema": {
"$ref": "#/definitions/models.LicenseError"
}
},
"500": {
"description": "something went wrong while creating new obligation classification",
"schema": {
"$ref": "#/definitions/models.LicenseError"
}
}
}
}
},
"/obligations/classifications/{classification}": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Deactivate an obligation classification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Obligations"
],
"summary": "Deactivate obligation classification",
"operationId": "DeleteObligationClassification",
"parameters": [
{
"type": "string",
"description": "Obligation Classification",
"name": "classification",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "cannot delete obligation classification 'GREEN' as it's still referenced by some obligations",
"schema": {
"$ref": "#/definitions/models.LicenseError"
}
},
"404": {
"description": "obligation classification 'GREEN' not found",
"schema": {
"$ref": "#/definitions/models.LicenseError"
}
},
"500": {
"description": "something went wrong while deleting obligation classification",
"schema": {
"$ref": "#/definitions/models.LicenseError"
}
}
}
}
},
"/obligations/export": {
"get": {
"security": [
Expand Down Expand Up @@ -1274,8 +1427,7 @@ const docTemplate = `{
"get": {
"security": [
{
"ApiKeyAuth": [],
"{}": []
"ApiKeyAuth": []
}
],
"description": "Get all active obligation types from the service",
Expand All @@ -1293,7 +1445,7 @@ const docTemplate = `{
"parameters": [
{
"type": "boolean",
"description": "Active obligation only",
"description": "Active obligation type only",
"name": "active",
"in": "query",
"required": true
Expand Down Expand Up @@ -2350,15 +2502,36 @@ const docTemplate = `{
},
"models.ObligationClassification": {
"type": "object",
"required": [
"classification",
"color"
],
"properties": {
"classification": {
"type": "string"
"type": "string",
"example": "GREEN"
},
"color": {
"type": "string"
"type": "string",
"example": "#00FF00"
}
}
},
"models.ObligationClassificationResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ObligationClassification"
}
},
"id": {
"type": "integer"
"paginationmeta": {
"$ref": "#/definitions/models.PaginationMeta"
},
"status": {
"type": "integer",
"example": 200
}
}
},
Expand Down
Loading
Loading