Skip to content

Commit

Permalink
feat(证书管理): 不返回关联的模型信息
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Nov 6, 2023
1 parent 70601df commit e032fae
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 154 deletions.
6 changes: 3 additions & 3 deletions app/models/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Cert struct {
CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"`
UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"`

Website *Website `gorm:"foreignKey:WebsiteID" json:"website"`
User *CertUser `gorm:"foreignKey:UserID" json:"user"`
DNS *CertDNS `gorm:"foreignKey:DNSID" json:"dns"`
Website *Website `gorm:"foreignKey:WebsiteID" json:"-"`
User *CertUser `gorm:"foreignKey:UserID" json:"-"`
DNS *CertDNS `gorm:"foreignKey:DNSID" json:"-"`
}
2 changes: 1 addition & 1 deletion app/models/cert_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type CertDNS struct {
CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"`
UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"`

Certs []*Cert `gorm:"foreignKey:DNSID" json:"certs"`
Certs []*Cert `gorm:"foreignKey:DNSID" json:"-"`
}

func (CertDNS) TableName() string {
Expand Down
2 changes: 1 addition & 1 deletion app/models/cert_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ type CertUser struct {
CreatedAt carbon.DateTime `gorm:"autoCreateTime;column:created_at" json:"created_at"`
UpdatedAt carbon.DateTime `gorm:"autoUpdateTime;column:updated_at" json:"updated_at"`

Certs []*Cert `gorm:"foreignKey:UserID" json:"certs"`
Certs []*Cert `gorm:"foreignKey:UserID" json:"-"`
}
56 changes: 0 additions & 56 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1199,9 +1199,6 @@ const docTemplate = `{
"created_at": {
"type": "string"
},
"dns": {
"$ref": "#/definitions/models.CertDNS"
},
"dns_id": {
"description": "关联的 DNS ID",
"type": "integer"
Expand All @@ -1226,16 +1223,10 @@ const docTemplate = `{
"updated_at": {
"type": "string"
},
"user": {
"$ref": "#/definitions/models.CertUser"
},
"user_id": {
"description": "关联的 ACME 用户 ID",
"type": "integer"
},
"website": {
"$ref": "#/definitions/models.Website"
},
"website_id": {
"description": "关联的网站 ID",
"type": "integer"
Expand All @@ -1245,12 +1236,6 @@ const docTemplate = `{
"models.CertDNS": {
"type": "object",
"properties": {
"certs": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Cert"
}
},
"created_at": {
"type": "string"
},
Expand Down Expand Up @@ -1280,12 +1265,6 @@ const docTemplate = `{
"description": "CA 提供商 (letsencrypt, zerossl, sslcom, google, buypass)",
"type": "string"
},
"certs": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Cert"
}
},
"created_at": {
"type": "string"
},
Expand All @@ -1312,41 +1291,6 @@ const docTemplate = `{
}
}
},
"models.Website": {
"type": "object",
"properties": {
"cert": {
"$ref": "#/definitions/models.Cert"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"php": {
"type": "integer"
},
"remark": {
"type": "string"
},
"ssl": {
"type": "boolean"
},
"status": {
"type": "boolean"
},
"updated_at": {
"type": "string"
}
}
},
"requests.CertStore": {
"type": "object",
"properties": {
Expand Down
56 changes: 0 additions & 56 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1192,9 +1192,6 @@
"created_at": {
"type": "string"
},
"dns": {
"$ref": "#/definitions/models.CertDNS"
},
"dns_id": {
"description": "关联的 DNS ID",
"type": "integer"
Expand All @@ -1219,16 +1216,10 @@
"updated_at": {
"type": "string"
},
"user": {
"$ref": "#/definitions/models.CertUser"
},
"user_id": {
"description": "关联的 ACME 用户 ID",
"type": "integer"
},
"website": {
"$ref": "#/definitions/models.Website"
},
"website_id": {
"description": "关联的网站 ID",
"type": "integer"
Expand All @@ -1238,12 +1229,6 @@
"models.CertDNS": {
"type": "object",
"properties": {
"certs": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Cert"
}
},
"created_at": {
"type": "string"
},
Expand Down Expand Up @@ -1273,12 +1258,6 @@
"description": "CA 提供商 (letsencrypt, zerossl, sslcom, google, buypass)",
"type": "string"
},
"certs": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Cert"
}
},
"created_at": {
"type": "string"
},
Expand All @@ -1305,41 +1284,6 @@
}
}
},
"models.Website": {
"type": "object",
"properties": {
"cert": {
"$ref": "#/definitions/models.Cert"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"php": {
"type": "integer"
},
"remark": {
"type": "string"
},
"ssl": {
"type": "boolean"
},
"status": {
"type": "boolean"
},
"updated_at": {
"type": "string"
}
}
},
"requests.CertStore": {
"type": "object",
"properties": {
Expand Down
37 changes: 0 additions & 37 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ definitions:
type: string
created_at:
type: string
dns:
$ref: '#/definitions/models.CertDNS'
dns_id:
description: 关联的 DNS ID
type: integer
Expand All @@ -71,23 +69,15 @@ definitions:
type: string
updated_at:
type: string
user:
$ref: '#/definitions/models.CertUser'
user_id:
description: 关联的 ACME 用户 ID
type: integer
website:
$ref: '#/definitions/models.Website'
website_id:
description: 关联的网站 ID
type: integer
type: object
models.CertDNS:
properties:
certs:
items:
$ref: '#/definitions/models.Cert'
type: array
created_at:
type: string
dns_param:
Expand All @@ -108,10 +98,6 @@ definitions:
ca:
description: CA 提供商 (letsencrypt, zerossl, sslcom, google, buypass)
type: string
certs:
items:
$ref: '#/definitions/models.Cert'
type: array
created_at:
type: string
email:
Expand All @@ -129,29 +115,6 @@ definitions:
updated_at:
type: string
type: object
models.Website:
properties:
cert:
$ref: '#/definitions/models.Cert'
created_at:
type: string
id:
type: integer
name:
type: string
path:
type: string
php:
type: integer
remark:
type: string
ssl:
type: boolean
status:
type: boolean
updated_at:
type: string
type: object
requests.CertStore:
properties:
auto_renew:
Expand Down

0 comments on commit e032fae

Please sign in to comment.