Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord #113
@ -30,4 +30,45 @@ message WebsiteRegistrationRecord {
|
||||
string tls_cert_cid = 4 [(gogoproto.moretags) = "json:\"TLSCertCID\" yaml:\"TLSCertCID\""];
|
||||
string type = 5 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string version = 6 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
}
|
||||
}
|
||||
|
||||
message ApplicationRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
||||
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string homepage = 5 [(gogoproto.moretags) = "json:\"homepage\" yaml:\"homepage\""];
|
||||
string license = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""];
|
||||
string author = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""];
|
||||
string repository = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
|
||||
string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""];
|
||||
string app_version = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
|
||||
string app_type = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
|
||||
string engines = 12 [(gogoproto.moretags) = "json:\"engines\" yaml:\"engines\""];
|
||||
repeated string os = 13 [(gogoproto.moretags) = "json:\"os\" yaml:\"os\""];
|
||||
repeated string cpu = 14 [(gogoproto.moretags) = "json:\"cpu\" yaml:\"cpu\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message WebAppDeploymentRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
||||
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string application = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
|
||||
string url = 6 [(gogoproto.moretags) = "json:\"url\" yaml:\"url\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
||||
message GeneralRecord {
|
||||
string type = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
|
||||
string name = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
|
||||
string description = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
|
||||
string version = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
|
||||
string category = 5 [(gogoproto.moretags) = "json:\"category\" yaml:\"category\""];
|
||||
string value = 6 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
|
||||
string meta = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
|
||||
repeated string tags = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
|
||||
}
|
||||
|
@ -339,6 +339,9 @@ func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) erro
|
||||
}
|
||||
}
|
||||
case "WebsiteRegistrationRecord":
|
||||
case "ApplicationRecord":
|
||||
case "WebAppDeploymentRecord":
|
||||
case "GeneralRecord":
|
||||
{
|
||||
// #nosec G705
|
||||
for key := range record.Attributes {
|
||||
|
2133
x/registry/types/attributes.pb.go
generated
2133
x/registry/types/attributes.pb.go
generated
File diff suppressed because it is too large
Load Diff
@ -50,6 +50,24 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
|
||||
(*Attributes)(nil),
|
||||
&WebsiteRegistrationRecord{},
|
||||
)
|
||||
|
||||
registry.RegisterInterface(
|
||||
"vulcanize.registry.v1beta1.ApplicationRecord",
|
||||
(*Attributes)(nil),
|
||||
&ApplicationRecord{},
|
||||
)
|
||||
|
||||
registry.RegisterInterface(
|
||||
"vulcanize.registry.v1beta1.WebAppDeploymentRecord",
|
||||
(*Attributes)(nil),
|
||||
&WebAppDeploymentRecord{},
|
||||
)
|
||||
|
||||
registry.RegisterInterface(
|
||||
"vulcanize.registry.v1beta1.GeneralRecord",
|
||||
(*Attributes)(nil),
|
||||
&GeneralRecord{},
|
||||
)
|
||||
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,33 @@ func payLoadAttributes(recordPayLoad map[string]interface{}) (*codectypes.Any, e
|
||||
}
|
||||
return codectypes.NewAnyWithValue(&attributes)
|
||||
}
|
||||
case "ApplicationRecord":
|
||||
{
|
||||
var attributes ApplicationRecord
|
||||
err := json.Unmarshal(bz, &attributes)
|
||||
if err != nil {
|
||||
return &codectypes.Any{}, err
|
||||
}
|
||||
return codectypes.NewAnyWithValue(&attributes)
|
||||
}
|
||||
case "WebAppDeploymentRecord":
|
||||
{
|
||||
var attributes WebAppDeploymentRecord
|
||||
err := json.Unmarshal(bz, &attributes)
|
||||
if err != nil {
|
||||
return &codectypes.Any{}, err
|
||||
}
|
||||
return codectypes.NewAnyWithValue(&attributes)
|
||||
}
|
||||
case "GeneralRecord":
|
||||
{
|
||||
var attributes GeneralRecord
|
||||
err := json.Unmarshal(bz, &attributes)
|
||||
if err != nil {
|
||||
return &codectypes.Any{}, err
|
||||
}
|
||||
return codectypes.NewAnyWithValue(&attributes)
|
||||
}
|
||||
default:
|
||||
return &codectypes.Any{}, fmt.Errorf("unsupported record type %s", recordType.(string))
|
||||
}
|
||||
@ -135,6 +162,45 @@ func GetJSONBytesFromAny(any codectypes.Any) ([]byte, error) {
|
||||
panic("Proto unmarshal error")
|
||||
}
|
||||
|
||||
bz, err = json.Marshal(attributes)
|
||||
if err != nil {
|
||||
panic("JSON marshal error")
|
||||
}
|
||||
}
|
||||
case "ApplicationRecord":
|
||||
{
|
||||
var attributes ApplicationRecord
|
||||
err := proto.Unmarshal(any.Value, &attributes)
|
||||
if err != nil {
|
||||
panic("Proto unmarshal error")
|
||||
}
|
||||
|
||||
bz, err = json.Marshal(attributes)
|
||||
if err != nil {
|
||||
panic("JSON marshal error")
|
||||
}
|
||||
}
|
||||
case "WebAppDeploymentRecord":
|
||||
{
|
||||
var attributes WebAppDeploymentRecord
|
||||
err := proto.Unmarshal(any.Value, &attributes)
|
||||
if err != nil {
|
||||
panic("Proto unmarshal error")
|
||||
}
|
||||
|
||||
bz, err = json.Marshal(attributes)
|
||||
if err != nil {
|
||||
panic("JSON marshal error")
|
||||
}
|
||||
}
|
||||
case "GeneralRecord":
|
||||
{
|
||||
var attributes GeneralRecord
|
||||
err := proto.Unmarshal(any.Value, &attributes)
|
||||
if err != nil {
|
||||
panic("Proto unmarshal error")
|
||||
}
|
||||
|
||||
bz, err = json.Marshal(attributes)
|
||||
if err != nil {
|
||||
panic("JSON marshal error")
|
||||
|
Loading…
Reference in New Issue
Block a user