daily-code icon indicating copy to clipboard operation
daily-code copied to clipboard

[urgent] Let admins put a notion doc top level page that auto creates a track

Open hkirat opened this issue 10 months ago • 6 comments

Right now , the process of creating a track looks like this -

  1. Educator creates the track (Ref - https://www.notion.so/Redis-Pub-subs-and-Messaging-queues-2954d8a8a782433e8775dc179dff3033 )
  2. Mods manually seed data in the database

Would be nice if somehow all titles and pages are autoscraped so the admin can simply add the top level page (https://www.notion.so/Redis-Pub-subs-and-Messaging-queues-2954d8a8a782433e8775dc179dff3033 ) and the title, image and the page is created automatically

So the problems in the DB need to be scraped from the top level notion page

hkirat avatar Apr 11 '24 13:04 hkirat

Ref this already exists https://github.com/code100x/daily-code/pull/152

hkirat avatar Apr 11 '24 13:04 hkirat

as in the UI already exists so dont recreate it

hkirat avatar Apr 11 '24 13:04 hkirat

on it.

sameet11 avatar Apr 11 '24 16:04 sameet11

@hkirat Create a function feedNotionToDb Giving the input https://petal-estimate-4e9.notion.site/Redis-Pub-subs-and-Messaging-queues-2954d8a8a782433e8775dc179dff3033 which will give this expected output.

https://gist.github.com/SujithThirumalaisamy/0e21966605d5c039fa6fedc150243516

Is this what the scope of the issue is? Am I on the right track?

SujithThirumalaisamy avatar Apr 11 '24 16:04 SujithThirumalaisamy

Problem: Manual addtion of the Notion to the Database Solution: Created a api endpoint to hit it from the admin pannel How It works? This api end point takes NotionLink, ImageLink with the description and seeds the tracks into the database.

https://github.com/code100x/daily-code/assets/108384868/c9a84820-7480-4e11-8e6c-5be06791d30e

SujithThirumalaisamy avatar Apr 11 '24 18:04 SujithThirumalaisamy

Implemented the frontend successfully.

Hit the end point with ImageURL, NotionURL and Description for the Track.

**Implementation:**
1. Fetch the Title and id of the Notion document with the link
2. Fetch the page with the id and fetch all of the data in the block with the ids with the NotionAPI Client
3. Propogate the data to the database

Waiting for the suggession on improving this. @hkirat

SujithThirumalaisamy avatar Apr 11 '24 18:04 SujithThirumalaisamy