dialtone_sqlx 0.1.0

Dialtone SQLx Back-End
Documentation
use dialtone_common::ap::ap_object::{ApObject, ApObjectType};
use dialtone_sqlx::control::ap_object::create::create_ap_object;
use dialtone_test_util::create_site::create_site_tst_utl;
use dialtone_test_util::{test_action, test_pg};

#[tokio::test]
async fn create_ap_object_test() {
    test_pg::test_pg(move |pool| async move {
        let host_name = "example.net";
        create_site_tst_utl(&pool, host_name).await;
        let ap_object = ApObject {
            name: None,
            id: Some("https://example.net/pub/bar/this_is_a_post".to_string()),
            url: None,
            media_type: None,
            ap_type: Option::from(ApObjectType::Article),
            content: Some("<p>this is a post</p>".to_string()),
            summary: None,
            actor: None,
            attributed_to: None,
            to: None,
            cc: None,
            bto: None,
            bcc: None,
        };
        let action = create_ap_object(&pool, &ap_object, host_name).await;
        test_action!(action);
        println!("ap_objects id = {}", action.unwrap());
    })
    .await;
}