-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix POST /model-configuration endpoint logic (#4350)
- Loading branch information
Showing
7 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...terarium/hmiserver/models/dataservice/model/configurations/InferredParameterSemantic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package software.uncharted.terarium.hmiserver.models.dataservice.model.configurations; | ||
|
||
import com.fasterxml.jackson.annotation.JsonBackReference; | ||
import io.hypersistence.utils.hibernate.type.json.JsonType; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.experimental.Accessors; | ||
import org.hibernate.annotations.Type; | ||
import software.uncharted.terarium.hmiserver.annotations.TSIgnore; | ||
import software.uncharted.terarium.hmiserver.annotations.TSModel; | ||
import software.uncharted.terarium.hmiserver.models.dataservice.modelparts.ModelDistribution; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@TSModel | ||
@Accessors | ||
@Entity | ||
public class InferredParameterSemantic extends Semantic { | ||
|
||
private String referenceId; | ||
|
||
@Type(JsonType.class) | ||
@Column(columnDefinition = "json") | ||
private ModelDistribution distribution; | ||
|
||
private boolean isDefault; | ||
|
||
@ManyToOne | ||
@JsonBackReference | ||
@Schema(hidden = true) | ||
@TSIgnore | ||
@NotNull | ||
private ModelConfiguration modelConfiguration; | ||
|
||
@Override | ||
public InferredParameterSemantic clone() { | ||
final InferredParameterSemantic clone = new InferredParameterSemantic(); | ||
super.cloneSuperFields(clone); | ||
clone.referenceId = this.referenceId; | ||
clone.distribution = this.distribution.clone(); | ||
clone.isDefault = this.isDefault; | ||
return clone; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/server/src/main/resources/db/migration/V16_semantic_constraint.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE model_configuration DROP COLUMN IF EXISTS calibration_run_id; | ||
ALTER TABLE semantic DROP CONSTRAINT semantic_type_check; | ||
ALTER TABLE semantic ADD CONSTRAINT semantic_type_check CHECK (type >= 0 AND type <= 3); | ||
|
||
COMMIT; |