created device config, created new UI elements in device dashboard
This commit is contained in:
36
server/internal/dto/cert.go
Normal file
36
server/internal/dto/cert.go
Normal file
@@ -0,0 +1,36 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user