mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-11 06:59:51 +00:00
feat: rename certificate props 'issuer' to 'issuerOrg'
This commit is contained in:
parent
3462e454d0
commit
3098f6a82f
@ -20,7 +20,7 @@ type Certificate struct {
|
|||||||
SerialNumber string `json:"serialNumber" db:"serialNumber"`
|
SerialNumber string `json:"serialNumber" db:"serialNumber"`
|
||||||
Certificate string `json:"certificate" db:"certificate"`
|
Certificate string `json:"certificate" db:"certificate"`
|
||||||
PrivateKey string `json:"privateKey" db:"privateKey"`
|
PrivateKey string `json:"privateKey" db:"privateKey"`
|
||||||
Issuer string `json:"issuer" db:"issuer"`
|
IssuerOrg string `json:"issuerOrg" db:"issuerOrg"`
|
||||||
IssuerCertificate string `json:"issuerCertificate" db:"issuerCertificate"`
|
IssuerCertificate string `json:"issuerCertificate" db:"issuerCertificate"`
|
||||||
KeyAlgorithm CertificateKeyAlgorithmType `json:"keyAlgorithm" db:"keyAlgorithm"`
|
KeyAlgorithm CertificateKeyAlgorithmType `json:"keyAlgorithm" db:"keyAlgorithm"`
|
||||||
EffectAt time.Time `json:"effectAt" db:"effectAt"`
|
EffectAt time.Time `json:"effectAt" db:"effectAt"`
|
||||||
@ -38,7 +38,7 @@ type Certificate struct {
|
|||||||
func (c *Certificate) PopulateFromX509(certX509 *x509.Certificate) *Certificate {
|
func (c *Certificate) PopulateFromX509(certX509 *x509.Certificate) *Certificate {
|
||||||
c.SubjectAltNames = strings.Join(certX509.DNSNames, ";")
|
c.SubjectAltNames = strings.Join(certX509.DNSNames, ";")
|
||||||
c.SerialNumber = strings.ToUpper(certX509.SerialNumber.Text(16))
|
c.SerialNumber = strings.ToUpper(certX509.SerialNumber.Text(16))
|
||||||
c.Issuer = strings.Join(certX509.Issuer.Organization, ";")
|
c.IssuerOrg = strings.Join(certX509.Issuer.Organization, ";")
|
||||||
c.EffectAt = certX509.NotBefore
|
c.EffectAt = certX509.NotBefore
|
||||||
c.ExpireAt = certX509.NotAfter
|
c.ExpireAt = certX509.NotAfter
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ func (r *CertificateRepository) Save(ctx context.Context, certificate *domain.Ce
|
|||||||
record.Set("serialNumber", certificate.SerialNumber)
|
record.Set("serialNumber", certificate.SerialNumber)
|
||||||
record.Set("certificate", certificate.Certificate)
|
record.Set("certificate", certificate.Certificate)
|
||||||
record.Set("privateKey", certificate.PrivateKey)
|
record.Set("privateKey", certificate.PrivateKey)
|
||||||
record.Set("issuer", certificate.Issuer)
|
record.Set("issuerOrg", certificate.IssuerOrg)
|
||||||
record.Set("issuerCertificate", certificate.IssuerCertificate)
|
record.Set("issuerCertificate", certificate.IssuerCertificate)
|
||||||
record.Set("keyAlgorithm", string(certificate.KeyAlgorithm))
|
record.Set("keyAlgorithm", string(certificate.KeyAlgorithm))
|
||||||
record.Set("effectAt", certificate.EffectAt)
|
record.Set("effectAt", certificate.EffectAt)
|
||||||
@ -162,7 +162,7 @@ func (r *CertificateRepository) castRecordToModel(record *core.Record) (*domain.
|
|||||||
SerialNumber: record.GetString("serialNumber"),
|
SerialNumber: record.GetString("serialNumber"),
|
||||||
Certificate: record.GetString("certificate"),
|
Certificate: record.GetString("certificate"),
|
||||||
PrivateKey: record.GetString("privateKey"),
|
PrivateKey: record.GetString("privateKey"),
|
||||||
Issuer: record.GetString("issuer"),
|
IssuerOrg: record.GetString("issuerOrg"),
|
||||||
IssuerCertificate: record.GetString("issuerCertificate"),
|
IssuerCertificate: record.GetString("issuerCertificate"),
|
||||||
KeyAlgorithm: domain.CertificateKeyAlgorithmType(record.GetString("keyAlgorithm")),
|
KeyAlgorithm: domain.CertificateKeyAlgorithmType(record.GetString("keyAlgorithm")),
|
||||||
EffectAt: record.GetDateTime("effectAt").Time(),
|
EffectAt: record.GetDateTime("effectAt").Time(),
|
||||||
|
@ -7,6 +7,35 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
m.Register(func(app core.App) error {
|
m.Register(func(app core.App) error {
|
||||||
|
// update collection `certificate`
|
||||||
|
{
|
||||||
|
collection, err := app.FindCollectionByNameOrId("4szxr9x43tpj6np")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := collection.Fields.AddMarshaledJSONAt(6, []byte(`{
|
||||||
|
"autogeneratePattern": "",
|
||||||
|
"hidden": false,
|
||||||
|
"id": "text2910474005",
|
||||||
|
"max": 0,
|
||||||
|
"min": 0,
|
||||||
|
"name": "issuerOrg",
|
||||||
|
"pattern": "",
|
||||||
|
"presentable": false,
|
||||||
|
"primaryKey": false,
|
||||||
|
"required": false,
|
||||||
|
"system": false,
|
||||||
|
"type": "text"
|
||||||
|
}`)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := app.Save(collection); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// migrate data
|
// migrate data
|
||||||
{
|
{
|
||||||
accesses, err := app.FindAllRecords("access")
|
accesses, err := app.FindAllRecords("access")
|
||||||
|
@ -42,7 +42,7 @@ const CertificateDetail = ({ data, ...props }: CertificateDetailProps) => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={t("certificate.props.issuer")}>
|
<Form.Item label={t("certificate.props.issuer")}>
|
||||||
<Input value={data.issuer} variant="filled" placeholder="" />
|
<Input value={data.issuerOrg} variant="filled" placeholder="" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={t("certificate.props.validity")}>
|
<Form.Item label={t("certificate.props.validity")}>
|
||||||
|
@ -6,7 +6,7 @@ export interface CertificateModel extends BaseModel {
|
|||||||
serialNumber: string;
|
serialNumber: string;
|
||||||
certificate: string;
|
certificate: string;
|
||||||
privateKey: string;
|
privateKey: string;
|
||||||
issuer: string;
|
issuerOrg: string;
|
||||||
keyAlgorithm: string;
|
keyAlgorithm: string;
|
||||||
effectAt: ISO8601String;
|
effectAt: ISO8601String;
|
||||||
expireAt: ISO8601String;
|
expireAt: ISO8601String;
|
||||||
|
@ -126,11 +126,11 @@ const CertificateList = () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "issuer",
|
key: "brand",
|
||||||
title: t("certificate.props.brand"),
|
title: t("certificate.props.brand"),
|
||||||
render: (_, record) => (
|
render: (_, record) => (
|
||||||
<Space className="max-w-full" direction="vertical" size={4}>
|
<Space className="max-w-full" direction="vertical" size={4}>
|
||||||
<Typography.Text>{record.issuer}</Typography.Text>
|
<Typography.Text>{record.issuerOrg}</Typography.Text>
|
||||||
<Typography.Text>{record.keyAlgorithm}</Typography.Text>
|
<Typography.Text>{record.keyAlgorithm}</Typography.Text>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user