Rebuild SCUM plugin data ownership
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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)}
|
||||
}
|
||||
Reference in New Issue
Block a user