use serde_json::json;
use crate::atproto::{ChainState, Pool};
use crate::nginx::conf::Block;
use super::by_key_location;
pub(crate) fn body(state: &ChainState) -> serde_json::Value {
json!({
"did": state.did,
"handle": "handle.invalid",
"handleIsCorrect": false,
"collections": state.collections,
"didDoc": {},
})
}
pub(crate) fn seal(pool: &mut Pool, state: &ChainState) -> anyhow::Result<()> {
pool.put(
&format!("{}/describe.json", state.commit),
&serde_json::to_vec(&body(state))?,
)
}
pub(crate) fn location() -> Block {
by_key_location(
"repo.describeRepo",
"$arg_repo",
"$ks_atp_repo",
"describe.json",
)
}