fix: also for object

This commit is contained in:
əlemi 2024-03-21 20:11:00 +01:00
parent 9da5b09ec6
commit b222090aee
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -3,12 +3,12 @@ use sea_orm::EntityTrait;
use crate::{activitystream::Base, model::object, server::Context};
use super::JsonLD;
use super::{jsonld::LD, JsonLD};
pub async fn view(State(ctx) : State<Context>, Path(id): Path<String>) -> Result<JsonLD<serde_json::Value>, StatusCode> {
match object::Entity::find_by_id(ctx.oid(id)).one(ctx.db()).await {
Ok(Some(object)) => Ok(JsonLD(object.underlying_json_object())),
Ok(Some(object)) => Ok(JsonLD(object.underlying_json_object().ld_context())),
Ok(None) => Err(StatusCode::NOT_FOUND),
Err(e) => {
tracing::error!("error querying for object: {e}");