Skip to content

Commit

Permalink
feat(service image): handle context fields (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainDreidemy authored Oct 10, 2023
1 parent fdb0f52 commit 2ac3559
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 152 deletions.
33 changes: 29 additions & 4 deletions api/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions api/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1641,9 +1641,15 @@
"containerName": {
"type": "string"
},
"context": {
"type": "string"
},
"description": {
"type": "string"
},
"dockerFile": {
"type": "string"
},
"dockerImage": {
"type": "string"
},
Expand All @@ -1656,6 +1662,9 @@
"envFile": {
"type": "string"
},
"imageSelectionType": {
"type": "string"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -1901,6 +1910,9 @@
"id": {
"type": "string"
},
"imageSelectionType": {
"type": "string"
},
"name": {
"type": "string"
},
Expand All @@ -1918,9 +1930,15 @@
"containerName": {
"type": "string"
},
"context": {
"type": "string"
},
"description": {
"type": "string"
},
"dockerFile": {
"type": "string"
},
"dockerImage": {
"type": "string"
},
Expand All @@ -1942,6 +1960,9 @@
"id": {
"type": "string"
},
"imageSelectionType": {
"type": "string"
},
"name": {
"type": "string"
},
Expand Down Expand Up @@ -1977,13 +1998,13 @@
"description": {
"type": "string"
},
"dockerImage": {
"dockerFile": {
"type": "string"
},
"dockerTag": {
"dockerImage": {
"type": "string"
},
"dockerfile": {
"dockerTag": {
"type": "string"
},
"entrypoint": {
Expand All @@ -1992,6 +2013,9 @@
"envFile": {
"type": "string"
},
"imageSelectionType": {
"type": "string"
},
"name": {
"type": "string"
},
Expand Down
20 changes: 18 additions & 2 deletions api/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ definitions:
properties:
containerName:
type: string
context:
type: string
description:
type: string
dockerFile:
type: string
dockerImage:
type: string
dockerTag:
Expand All @@ -139,6 +143,8 @@ definitions:
type: string
envFile:
type: string
imageSelectionType:
type: string
name:
type: string
positionX:
Expand Down Expand Up @@ -308,6 +314,8 @@ definitions:
type: string
id:
type: string
imageSelectionType:
type: string
name:
type: string
positionX:
Expand All @@ -319,8 +327,12 @@ definitions:
properties:
containerName:
type: string
context:
type: string
description:
type: string
dockerFile:
type: string
dockerImage:
type: string
dockerTag:
Expand All @@ -335,6 +347,8 @@ definitions:
type: array
id:
type: string
imageSelectionType:
type: string
name:
type: string
ports:
Expand All @@ -358,16 +372,18 @@ definitions:
type: string
description:
type: string
dockerFile:
type: string
dockerImage:
type: string
dockerTag:
type: string
dockerfile:
type: string
entrypoint:
type: string
envFile:
type: string
imageSelectionType:
type: string
name:
type: string
positionX:
Expand Down
113 changes: 61 additions & 52 deletions api/src/models/service_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ package models
import "github.com/google/uuid"

type Service struct {
ID *uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
Name string `gorm:"type:varchar(255)"`
ContainerName string `gorm:"type:varchar(255)"`
DockerImage string `gorm:"type:varchar(255)"`
DockerTag string `gorm:"type:varchar(255)"`
EnvFile string `gorm:"type:varchar(255)"`
Entrypoint string `gorm:"type:varchar(255)"`
Description string `gorm:"type:text"`
PositionX float32 `gorm:"type:decimal(20,8);not null"`
PositionY float32 `gorm:"type:decimal(20,8);not null"`
Context string `gorm:"type:varchar(255)"`
Dockerfile string `gorm:"type:varchar(255)"`
ID *uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
Name string `gorm:"type:varchar(255)"`
ContainerName string `gorm:"type:varchar(255)"`
ImageSelectionType string `gorm:"type:varchar(255);default:'remote'"`
DockerImage string `gorm:"type:varchar(255)"`
DockerTag string `gorm:"type:varchar(255)"`
EnvFile string `gorm:"type:varchar(255)"`
Entrypoint string `gorm:"type:varchar(255)"`
Description string `gorm:"type:text"`
PositionX float32 `gorm:"type:decimal(20,8);not null"`
PositionY float32 `gorm:"type:decimal(20,8);not null"`
Context string `gorm:"type:varchar(255)"`
Dockerfile string `gorm:"type:varchar(255)"`

StackID string `gorm:"type:uuid;not null"`
Stack Stack
Expand All @@ -28,55 +29,63 @@ type Service struct {
}

type ServiceCreateInput struct {
Name string `json:"name"`
ContainerName string `json:"containerName"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
EnvFile string `json:"envFile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX" validate:"required"`
PositionY float32 `json:"positionY" validate:"required"`
Name string `json:"name"`
ContainerName string `json:"containerName"`
ImageSelectionType string `json:"imageSelectionType"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
Dockerfile string `json:"dockerFile"`
Context string `json:"context"`
EnvFile string `json:"envFile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX" validate:"required"`
PositionY float32 `json:"positionY" validate:"required"`
}

type ServiceUpdateInput struct {
Name string `json:"name"`
ContainerName string `json:"containerName"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
EnvFile string `json:"envFile"`
Context string `json:"context"`
Dockerfile string `json:"dockerfile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX"`
PositionY float32 `json:"positionY"`
Name string `json:"name"`
ContainerName string `json:"containerName"`
ImageSelectionType string `json:"imageSelectionType"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
EnvFile string `json:"envFile"`
Context string `json:"context"`
Dockerfile string `json:"dockerFile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX"`
PositionY float32 `json:"positionY"`
}

type ServiceResponse struct {
ID *uuid.UUID `json:"id"`
Name string `json:"name"`
ContainerName string `json:"containerName"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
EnvFile string `json:"envFile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX"`
PositionY float32 `json:"positionY"`
ID *uuid.UUID `json:"id"`
Name string `json:"name"`
ContainerName string `json:"containerName"`
ImageSelectionType string `json:"imageSelectionType"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
EnvFile string `json:"envFile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX"`
PositionY float32 `json:"positionY"`
}

type ServiceResponseItem struct {
ID *uuid.UUID `json:"id"`
Name string `json:"name"`
ContainerName string `json:"containerName"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
EnvFile string `json:"envFile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX"`
PositionY float32 `json:"positionY"`
ID *uuid.UUID `json:"id"`
Name string `json:"name"`
ImageSelectionType string `json:"imageSelectionType"`
ContainerName string `json:"containerName"`
DockerImage string `json:"dockerImage"`
DockerTag string `json:"dockerTag"`
Dockerfile string `json:"dockerFile"`
Context string `json:"context"`
EnvFile string `json:"envFile"`
Entrypoint string `json:"entrypoint"`
Description string `json:"description"`
PositionX float32 `json:"positionX"`
PositionY float32 `json:"positionY"`

Volumes []ServiceVolumeResponse `json:"volumes"`
EnvVariables []ServiceEnvVariableResponse `json:"envVariables"`
Expand Down
Loading

0 comments on commit 2ac3559

Please sign in to comment.