38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package dto
|
|
|
|
import (
|
|
"time"
|
|
|
|
"browser.local/platform/domain"
|
|
)
|
|
|
|
type PluginDataPutRequest struct {
|
|
Key string `json:"key"`
|
|
Value map[string]any `json:"value"`
|
|
}
|
|
|
|
type PluginDataRecordResponse struct {
|
|
Key string `json:"key"`
|
|
Value map[string]any `json:"value"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
type PluginDataListResponse struct {
|
|
Items []PluginDataRecordResponse `json:"items"`
|
|
Count int `json:"count"`
|
|
}
|
|
|
|
func PluginDataRecordFromDomain(value domain.PluginDataRecord) PluginDataRecordResponse {
|
|
value = domain.CopyPluginDataRecord(value)
|
|
return PluginDataRecordResponse{Key: value.Key, Value: value.Value, CreatedAt: value.CreatedAt, UpdatedAt: value.UpdatedAt}
|
|
}
|
|
|
|
func PluginDataRecordsFromDomain(values []domain.PluginDataRecord) PluginDataListResponse {
|
|
items := make([]PluginDataRecordResponse, len(values))
|
|
for index, value := range values {
|
|
items[index] = PluginDataRecordFromDomain(value)
|
|
}
|
|
return PluginDataListResponse{Items: items, Count: len(items)}
|
|
}
|