# Laravel Screenshot 2024-04-03 at 6 07 01 PM ### Message - Has many: Mentions ``` slack_user_id // string, from Slack JSON text // string, from Slack JSON blocks // JSON array from Slack user_profile // JSON object from Slack ts // string, from Slack JSON datetime // parsed ts from Slack JSON thread_ts // string, from Slack JSON, null true replies // JSON array from Slack, null true slack_url // string ``` - Chris/David will write Slack ingest - Chris/David will parse `ts` to get `datetime` - Chris/David will generate slack_url from channel id + ts ### Mention Belongs to: Person, Book, Message ``` person_id // FK to person table book_id // FK to books table message_id // FK to messages table sentiment // string, one of: positive, neutral, negative; null true summary // string, null true ``` - Chris/David will process Messages - Detect Book - Find or create Book by Title - Find or create Person by slack_user_id - Insert Mention in DB with person_id, book_id, message_id ### Person Has many: Mentions ``` slack_user_id // string real_name // string first_name // string profile_img_url // string, null true deleted // boolean, default true ``` ### Book Has many: Mentions ``` title // string author // string isbn // string cover_art_url // string, null true ``` # Laravel API ### GET /books Returns list of Books ordered by date of most recent Mention ``` title author cover_art_url last_mention_date // datetime of most recent Mention person_mention_count // integer, count of persons who have Mentioned this book array of profile_img_url of People with Mentions of this book ``` - Can this include an optional search param? - pagination? (default view shows first 10 based on date of most recent Mention) ### GET /books/:id Returns details for a single Book + its Mentions (mentions ordered by most recent) ``` title author cover_art_url positive_mention_count // integer neutral_mention_count // integer negative_mention_count // integer mentions { mention_person_profile_img_url mention_person_real_name mention_person_deleted mention_message_datetime mention_message_slack_url mention_sentiment mention_summary } ``` - Do we want to return sentiment count in the API schema, or should Remix pull those from Mentions? ### GET /people Returns list of People ordered alphabetically by first name ``` real_name profile_img_url deleted book_mention_count // integer, count of Books this person has mentioned array of cover_art_url of books this user has Mentioned ``` - Can this include an optional search param? - pagination? (default view shows first 10 based on date of most recent Mention) ### GET /people/:id Returns details for a single Person + their Mentions (mentions ordered by most recent) ``` real_name profile_img_url deleted mentions { mention_book_title mention_book_author mention_book_cover_art_url mention_message_datetime mention_message_slack_url mention_sentiment mention_summary } ```