Skip to content

Commit

Permalink
Merge pull request #86 from siemens/refactor/obligations
Browse files Browse the repository at this point in the history
refactor(obligations): Make separate database tables for classification and type
  • Loading branch information
GMishx authored Oct 22, 2024
2 parents 4eee53c + a2daf91 commit a90a43d
Show file tree
Hide file tree
Showing 12 changed files with 1,155 additions and 1,331 deletions.
325 changes: 138 additions & 187 deletions cmd/laas/docs/docs.go

Large diffs are not rendered by default.

325 changes: 138 additions & 187 deletions cmd/laas/docs/swagger.json

Large diffs are not rendered by default.

238 changes: 95 additions & 143 deletions cmd/laas/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ definitions:
notes:
example: This license has been superseded.
type: string
obligations:
items:
$ref: '#/definitions/models.Obligation'
type: array
risk:
maximum: 5
minimum: 0
Expand Down Expand Up @@ -299,6 +303,10 @@ definitions:
notes:
example: This license has been superseded.
type: string
obligations:
items:
$ref: '#/definitions/models.Obligation'
type: array
risk:
example: 1
maximum: 5
Expand All @@ -325,71 +333,52 @@ definitions:
active:
type: boolean
classification:
enum:
- green
- white
- yellow
- red
example: green
type: string
$ref: '#/definitions/models.ObligationClassification'
comment:
type: string
id:
example: 147
type: integer
licenses:
items:
$ref: '#/definitions/models.LicenseDB'
type: array
md5:
type: string
modifications:
example: true
type: boolean
obligationClassificationId:
type: integer
obligationTypeId:
type: integer
text:
example: Source code be made available when distributing the software.
type: string
text_updatable:
example: true
textUpdatable:
type: boolean
topic:
example: copyleft
type: string
type:
enum:
- obligation
- restriction
- risk
- right
example: risk
type: string
$ref: '#/definitions/models.ObligationType'
type: object
models.ObligationId:
models.ObligationClassification:
properties:
id:
example: 31
type: integer
topic:
example: copyleft
classification:
type: string
type: object
models.ObligationImportStatus:
properties:
data:
$ref: '#/definitions/models.ObligationId'
status:
example: 200
color:
type: string
id:
type: integer
type: object
models.ObligationJSONFileFormat:
models.ObligationDTO:
properties:
active:
type: boolean
classification:
enum:
- green
- white
- yellow
- red
example: GREEN
type: string
comment:
example: This is a comment.
type: string
modifications:
example: true
type: boolean
shortnames:
example:
Expand All @@ -402,30 +391,40 @@ definitions:
example: Source code be made available when distributing the software.
type: string
text_updatable:
example: true
type: boolean
topic:
description: binding:"required" tag cannot be used as is works only for request
body
example: copyleft
type: string
type:
enum:
- obligation
- restriction
- risk
- right
example: RISK
type: string
required:
- active
- classification
- comment
- modifications
- shortnames
- text
- text_updatable
- topic
- type
type: object
models.ObligationId:
properties:
id:
example: 31
type: integer
topic:
example: copyleft
type: string
type: object
models.ObligationImportStatus:
properties:
data:
$ref: '#/definitions/models.ObligationId'
message:
type: string
status:
example: 200
type: integer
type: object
models.ObligationMapResponse:
properties:
data:
Expand Down Expand Up @@ -459,82 +458,6 @@ definitions:
example: obligation
type: string
type: object
models.ObligationPATCHRequestJSONSchema:
properties:
active:
example: true
type: boolean
classification:
enum:
- green
- white
- yellow
- red
type: string
comment:
example: This is a comment.
type: string
modifications:
type: boolean
text:
example: Source code be made available when distributing the software.
type: string
text_updatable:
type: boolean
type:
enum:
- obligation
- restriction
- risk
- right
type: string
type: object
models.ObligationPOSTRequestJSONSchema:
properties:
active:
example: true
type: boolean
classification:
enum:
- green
- white
- yellow
- red
type: string
comment:
type: string
modifications:
type: boolean
shortnames:
example:
- GPL-2.0-only
- GPL-2.0-or-later
items:
type: string
type: array
text:
example: Source code be made available when distributing the software.
type: string
topic:
example: copyleft
type: string
type:
enum:
- obligation
- restriction
- risk
- right
type: string
required:
- active
- classification
- comment
- modifications
- shortnames
- text
- topic
- type
type: object
models.ObligationPreview:
properties:
topic:
Expand All @@ -558,17 +481,34 @@ definitions:
example: 200
type: integer
type: object
models.ObligationResponse:
models.ObligationType:
properties:
data:
items:
$ref: '#/definitions/models.Obligation'
type: array
paginationmeta:
$ref: '#/definitions/models.PaginationMeta'
status:
example: 200
id:
type: integer
type:
type: string
type: object
models.ObligationUpdateDTO:
properties:
active:
type: boolean
classification:
example: GREEN
type: string
comment:
type: string
modifications:
example: true
type: boolean
text:
example: Source code be made available when distributing the software.
type: string
text_updatable:
example: true
type: boolean
type:
example: RISK
type: string
type: object
models.PaginationMeta:
properties:
Expand Down Expand Up @@ -608,6 +548,18 @@ definitions:
- field
- search_term
type: object
models.SwaggerObligationResponse:
properties:
data:
items:
$ref: '#/definitions/models.ObligationDTO'
type: array
paginationmeta:
$ref: '#/definitions/models.PaginationMeta'
status:
example: 200
type: integer
type: object
models.User:
properties:
id:
Expand Down Expand Up @@ -1349,7 +1301,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/models.ObligationResponse'
$ref: '#/definitions/models.SwaggerObligationResponse'
"404":
description: No obligations in DB
schema:
Expand All @@ -1371,14 +1323,14 @@ paths:
name: obligation
required: true
schema:
$ref: '#/definitions/models.ObligationPOSTRequestJSONSchema'
$ref: '#/definitions/models.ObligationDTO'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/models.ObligationResponse'
$ref: '#/definitions/models.SwaggerObligationResponse'
"400":
description: Bad request body
schema:
Expand Down Expand Up @@ -1439,7 +1391,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/models.ObligationResponse'
$ref: '#/definitions/models.SwaggerObligationResponse'
"404":
description: No obligation with given topic found
schema:
Expand All @@ -1466,14 +1418,14 @@ paths:
name: obligation
required: true
schema:
$ref: '#/definitions/models.ObligationPATCHRequestJSONSchema'
$ref: '#/definitions/models.ObligationUpdateDTO'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.ObligationResponse'
$ref: '#/definitions/models.SwaggerObligationResponse'
"400":
description: Invalid request
schema:
Expand Down Expand Up @@ -1543,7 +1495,7 @@ paths:
description: OK
schema:
items:
$ref: '#/definitions/models.ObligationJSONFileFormat'
$ref: '#/definitions/models.ObligationDTO'
type: array
"500":
description: Failed to fetch obligations
Expand Down
Loading

0 comments on commit a90a43d

Please sign in to comment.