Skip to content

Commit

Permalink
fix: add name and description on model
Browse files Browse the repository at this point in the history
  • Loading branch information
alarv committed Jun 4, 2024
1 parent b6e939c commit d4c783f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/org/jaqpot/api/entity/Model.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class Model(
@Column(name = "meta", columnDefinition = "jsonb")
val meta: Map<String, Any>?,

@Column(nullable = false)
val name: String,

@Column(nullable = false)
val description: String,

// TODO create specific model types
val type: String?,

Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/org/jaqpot/api/mapper/ModelMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import org.jaqpot.api.model.UserDto

fun Model.toDto(userDto: UserDto): ModelDto {
return ModelDto(
this.name,
this.description,
this.jaqpotpyVersion,
this.libraries.map { it.toDto() },
this.dependentFeatures.map { it.toDto() },
Expand All @@ -28,6 +30,8 @@ fun ModelDto.toEntity(userId: String): Model {
this.id,
userId,
this.meta,
this.name,
this.description,
this.type,
this.jaqpotpyVersion,
mutableListOf(),
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/db/migration/V2__create_main_entities.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CREATE TABLE model
created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
updated_at TIMESTAMP WITHOUT TIME ZONE NOT NULL,
user_id VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
meta JSONB,
type VARCHAR(255),
jaqpotpy_version VARCHAR(255) NOT NULL,
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ components:
- dependentFeatures
- independentFeatures
- actualModel
- name
- description
properties:
id:
type: integer
Expand All @@ -127,6 +129,14 @@ components:
description: A JSON object containing meta information.
additionalProperties:
type: object
name:
type: string
minLength: 3
maxLength: 255
example: My Model
description:
type: string
example: A description of your model
type:
type: string
example: some type
Expand Down

0 comments on commit d4c783f

Please sign in to comment.