pub fn create_thread_with_initial_post(
        new_thread: NewThread,
        post_content: String,
        conn: &PgConnection,
    ) -> BackendResult<ThreadData> {
        let thread: Thread = Thread::create_thread(new_thread, conn)?;

        let new_post: NewPost = NewPost::from((thread.clone(), post_content));

        let post_data: ChildlessPostData = Post::create_and_get_user(new_post, conn)?;
        let user: User = post_data.user.clone();
        Ok(ThreadData {
            thread,
            post: PostData::from(post_data),
            user,
        })
    }
/// Creates a thread with an initial post.
Creates a thread with an initial post.
Creates a thread with an initial post .
pub fn create_thread_with_initial_post(
        new_thread: NewThread,
        post_content: String,
        conn: &PgConnection,
    ) -> BackendResult<ThreadData> {
        let thread: Thread = Thread::create_thread(new_thread, conn)?;
        let new_post: NewPost = NewPost::from((thread.clone(), post_content));
        let post_data: ChildlessPostData = Post::create_and_get_user(new_post, conn)?;
        let user: User = post_data.user.clone();
        Ok(ThreadData {
            thread,
            post: PostData::from(post_data),
            user,
        })
    }
pub fn create_thread_with_initial_post ( new_thread : NewThread , post_content : String , conn : & PgConnection , ) -> BackendResult < ThreadData > { let thread : Thread = Thread :: create_thread ( new_thread , conn ) ? ; let new_post : NewPost = NewPost :: from ( ( thread . clone ( ) , post_content ) ) ; let post_data : ChildlessPostData = Post :: create_and_get_user ( new_post , conn ) ? ; let user : User = post_data . user . clone ( ) ; Ok ( ThreadData { thread , post : PostData :: from ( post_data ) , user , } ) }
Creates a thread with an initial post.
Creates a thread with an initial post .
new_thread
NewThread
post_content
String
conn
&PgConnection
new_thread
NewThread
post_content
String
conn
&PgConnection