add response 201

This commit is contained in:
Cayo Puigdefabregas 2022-04-25 14:05:30 +02:00
parent 531e213eff
commit f37e55e3b5
1 changed files with 7 additions and 1 deletions

View File

@ -69,7 +69,13 @@ class InventoryView(LoginMix, SnapshotMix):
db.session.add(snapshot)
db.session().final_flush()
db.session.commit()
self.response = self.schema.jsonify(snapshot)
self.response = jsonify(
{
'url': snapshot.device.url,
'dhid': snapshot.device.devicehub_id,
'sid': snapshot.sid,
}
)
self.response.status_code = 201
move_json(self.tmp_snapshots, self.path_snapshot, g.user.email)
return self.response