Return missing created_at field on reshares endpoint

This commit is contained in:
Jonne Haß 2020-01-24 16:58:32 +01:00
parent 0935451cd8
commit 35bfbc9c82
3 changed files with 16 additions and 1 deletions

View file

@ -25,6 +25,7 @@ module Api
reshares_page[:data] = reshares_page[:data].map do |r| reshares_page[:data] = reshares_page[:data].map do |r|
{ {
guid: r.guid, guid: r.guid,
created_at: r.created_at,
author: PersonPresenter.new(r.author).as_api_json author: PersonPresenter.new(r.author).as_api_json
} }
end end

View file

@ -337,6 +337,20 @@
] ]
}, },
"reshares": {
"type": "array",
"items": {
"type": "object",
"properties": {
"guid": { "$ref": "#/definitions/guid" },
"created_at": { "$ref": "#/definitions/timestamp" },
"author": { "$ref": "#/definitions/short_profile" }
},
"required": ["guid", "created_at", "author"],
"additionalProperties": false
}
},
"posts": { "posts": {
"type": "array", "type": "array",
"items": { "$ref": "#/definitions/post" } "items": { "$ref": "#/definitions/post" }

View file

@ -55,7 +55,7 @@ describe Api::V1::ResharesController do
expect(reshare["guid"]).not_to be_nil expect(reshare["guid"]).not_to be_nil
confirm_person_format(reshare["author"], alice) confirm_person_format(reshare["author"], alice)
expect(reshares.to_json).to match_json_schema(:api_v1_schema) expect(reshares.to_json).to match_json_schema(:api_v1_schema, fragment: "#/definitions/reshares")
end end
it "succeeds but empty with private post it can see" do it "succeeds but empty with private post it can see" do