Skip to content

Commit a948901

Browse files
Bug: System Check domain SQL native mismtach to GORM
1 parent b3f8f12 commit a948901

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

backend/cms-sys/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/FROM golang:1.24-alpine AS builder
1+
FROM golang:1.24-alpine AS builder
22

33
WORKDIR /app
44

backend/cms-sys/cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func main() {
4848
Host: utils.GetEnv("DB_HOST", "localhost"),
4949
Port: utils.GetEnvAsInt("DB_PORT", 5432),
5050
User: utils.GetEnv("DB_USER", "postgres"),
51-
Password: utils.GetEnv("DB_PASSWORD", "password"),
51+
Password: utils.GetEnv("DB_PASSWORD", "Swanhtet12@"),
5252
DBName: utils.GetEnv("DB_NAME", "cms_db"),
5353
SSLMode: utils.GetEnv("DB_SSL_MODE", "disable"),
5454
MaxOpenConns: utils.GetEnvAsInt("DB_MAX_OPEN_CONNS", 25),

backend/cms-sys/internal/types/model_types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ func (u *CMSUser) BeforeCreate(tx *gorm.DB) error {
5656
}
5757

5858
type CMSCusPurchase struct {
59-
RelationID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()" json:"relation_id"`
60-
CMSCusID uuid.UUID `gorm:"type:uuid;not null" json:"cms_cus_id"`
61-
SystemName SystemType `gorm:"type:system_type;not null" json:"system_name"`
62-
PurchaseDate time.Time `gorm:"not null;default:CURRENT_TIMESTAMP" json:"purchase_date"`
63-
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
64-
Customer CMSUser `gorm:"foreignKey:CMSCusID;references:CMSUserID" json:"customer,omitempty"`
59+
RelationID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()" json:"relation_id"`
60+
CMSCusID uuid.UUID `gorm:"type:uuid;not null" json:"cms_cus_id"`
61+
SystemName string `gorm:"type:varchar(100);not null" json:"system_name"`
62+
PurchaseDate time.Time `gorm:"not null;default:CURRENT_TIMESTAMP" json:"purchase_date"`
63+
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
64+
Customer CMSUser `gorm:"foreignKey:CMSCusID;references:CMSUserID" json:"customer,omitempty"`
6565
}
6666

6767
func (CMSCusPurchase) TableName() string {

docker-compose.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ services:
99
vault:
1010
condition: service_healthy
1111
postgres-cms:
12-
condition: service_started
12+
condition: service_healthy
1313
environment:
14-
- DB_HOST=${DB_HOST}
15-
- DB_PORT=${DB_PORT}
16-
- DB_NAME=${DB_NAME}
17-
- DB_USER=${DB_USER}
18-
- DB_PASSWORD=${DB_PASSWORD}
19-
- APP_ENV=${APP_ENV}
20-
- LOG_LEVEL=${LOG_LEVEL}
21-
- LOG_FILE_PATH=${LOG_FILE_PATH}
22-
- LOG_MAX_SIZE=${LOG_MAX_SIZE}
23-
- LOG_MAX_BACKUPS=${LOG_MAX_BACKUPS}
24-
- LOG_MAX_AGE=${LOG_MAX_AGE}
25-
- LOG_COMPRESS=${LOG_COMPRESS}
26-
- VAULT_ADDR=${VAULT_ADDR}
27-
- VAULT_TOKEN=${VAULT_TOKEN}
28-
- LOG_CONSOLE=${LOG_CONSOLE}
14+
- DB_HOST=postgres-cms
15+
- DB_PORT=5432
16+
- DB_NAME=cms_db
17+
- DB_USER=postgres
18+
- DB_PASSWORD=cms_password_123
19+
- APP_ENV=development
20+
- LOG_LEVEL=info
21+
- LOG_FILE_PATH=/app/logs/app.log
22+
- LOG_MAX_SIZE=100
23+
- LOG_MAX_BACKUPS=3
24+
- LOG_MAX_AGE=28
25+
- LOG_COMPRESS=true
26+
- VAULT_ADDR=http://vault:8200
27+
- VAULT_TOKEN=root
28+
- LOG_CONSOLE=true
2929
ports:
30-
- "${PORT}:8080"
30+
- "8080:8080"
3131
restart: unless-stopped
3232

3333
vault:
@@ -38,8 +38,8 @@ services:
3838
ports:
3939
- "8200:8200"
4040
environment:
41-
- VAULT_DEV_ROOT_TOKEN_ID=${VAULT_DEV_ROOT_TOKEN_ID}
42-
- VAULT_DEV_LISTEN_ADDRESS=${VAULT_DEV_LISTEN_ADDRESS}
41+
- VAULT_DEV_ROOT_TOKEN_ID=root
42+
- VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200
4343
volumes:
4444
- ./vault-init.sh:/vault-init.sh
4545
- ./rsa:/vault/keys
@@ -55,17 +55,17 @@ services:
5555
postgres-cms:
5656
image: postgres:15-alpine
5757
environment:
58-
- POSTGRES_DB=${DB_NAME}
59-
- POSTGRES_USER=${DB_USER}
60-
- POSTGRES_PASSWORD=${DB_PASSWORD}
58+
- POSTGRES_DB=cms_db
59+
- POSTGRES_USER=postgres
60+
- POSTGRES_PASSWORD=cms_password_123
6161
volumes:
6262
- postgres-cms:/var/lib/postgresql/data
6363
networks:
6464
- whole-system-network
6565
ports:
66-
- "${DB_PORT}:5432"
66+
- "5432:5432"
6767
healthcheck:
68-
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
68+
test: ["CMD-SHELL", "pg_isready -U postgres -d cms_db"]
6969
interval: 10s
7070
timeout: 5s
7171
retries: 5

0 commit comments

Comments
 (0)