37 lines
934 B
Go
37 lines
934 B
Go
package dto
|
|
|
|
import (
|
|
"smoop-api/internal/models"
|
|
"time"
|
|
)
|
|
|
|
type DeviceCertDto struct {
|
|
ID uint `json:"id"`
|
|
DeviceGUID string `json:"deviceGuid"`
|
|
SerialHex string `json:"serialHex"`
|
|
IssuerCN string `json:"issuerCN"`
|
|
SubjectDN string `json:"subjectDN"`
|
|
NotBefore time.Time `json:"notBefore"`
|
|
NotAfter time.Time `json:"notAfter"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
// PemCert is sensitive/noisy; expose only if you really need it:
|
|
// PemCert string `json:"pemCert,omitempty"`
|
|
}
|
|
|
|
type DeviceCertListDto struct {
|
|
Certs []DeviceCertDto `json:"certs"`
|
|
}
|
|
|
|
func MapDeviceCert(c models.DeviceCertificate) DeviceCertDto {
|
|
return DeviceCertDto{
|
|
ID: c.ID,
|
|
DeviceGUID: c.DeviceGUID,
|
|
SerialHex: c.SerialHex,
|
|
IssuerCN: c.IssuerCN,
|
|
SubjectDN: c.SubjectDN,
|
|
NotBefore: c.NotBefore,
|
|
NotAfter: c.NotAfter,
|
|
CreatedAt: c.CreatedAt,
|
|
}
|
|
}
|