Use 'schema' alias for schema.org

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2023-12-28 16:01:05 +01:00
parent e74996b732
commit 1b6301fee7
3 changed files with 19 additions and 24 deletions

View file

@ -68,19 +68,4 @@ defmacro status_object_fields do
field(:announcements, {:array, ObjectValidators.ObjectID}, default: [])
end
end
defmacro event_object_fields do
quote bind_quoted: binding() do
field(:startTime, ObjectValidators.DateTime)
field(:endTime, ObjectValidators.DateTime)
field(:joinMode, :string, default: "free")
embeds_one(:location, PlaceValidator)
field(:participation_count, :integer, default: 0)
field(:participations, {:array, ObjectValidators.ObjectID}, default: [])
field(:participation_request_count, :integer, default: 0)
end
end
end

View file

@ -22,9 +22,19 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EventValidator do
message_fields()
object_fields()
status_object_fields()
event_object_fields()
end
end
field(:startTime, ObjectValidators.DateTime)
field(:endTime, ObjectValidators.DateTime)
field(:joinMode, :string, default: "free")
embeds_one(:location, PlaceValidator)
field(:participation_count, :integer, default: 0)
field(:participations, {:array, ObjectValidators.ObjectID}, default: [])
field(:participation_request_count, :integer, default: 0)
end
def cast_and_apply(data) do

View file

@ -55,16 +55,16 @@
},
"participationMessage": {
"@id": "mz:participationMessage",
"@type": "sc:Text"
"@type": "schema:Text"
},
"streetAddress": "sc:streetAddress",
"postalCode": "sc:postalCode",
"addressLocality": "sc:addressLocality",
"addressRegion": "sc:addressRegion",
"addressCountry": "sc:addressCountry",
"streetAddress": "schema:streetAddress",
"postalCode": "schema:postalCode",
"addressLocality": "schema:addressLocality",
"addressRegion": "schema:addressRegion",
"addressCountry": "schema:addressCountry",
"location": {
"@id": "sc:location",
"@type": "sc:Place"
"@id": "schema:location",
"@type": "schema:Place"
}
}
]