Next.js Discord

Discord Forum

Need help getting the bigger picture.

Answered
Polar bear posted this in #help-forum
Open in Discord
Polar bearOP
Hello everyone, I need to build an app to archive a content for a writer, he makes a groups of posts, each group contains a different number of posts, each group have different shape for it's posts than other groups, I need to to build the dashboard to build the the groups and their posts dynamically, any ideas on how to do it, and what tools to use to accomplish this?
Answered by B33fb0n3
you can do the same: think of a database schema, extend the objects if there are different types (or add a type key inside an object) and then save the data inside of it.

After you saved it you can load it and display it. To display these specific objects create different components that render them correctly.

An example data structure could look like this:
https://pastebin.com/wPFFuZkg
View full answer

10 Replies

@Polar bear Hello everyone, I need to build an app to archive a content for a writer, he makes a groups of posts, each group contains a different number of posts, each group have different shape for it's posts than other groups, I need to to build the dashboard to build the the groups and their posts dynamically, any ideas on how to do it, and what tools to use to accomplish this?
inside your database you can save all posts the same. Maybe also group them there with a group object as well (but that's optional).

After you saved it, you can load it and display it. To display your post in different types, you can make different components that displays your post differently. All of these components take the same data, but display it differently
Polar bearOP
sorry if I didn't write what I meant clearly.
Polar bearOP
I want to archive the content for a scholar who sometimes writes a series of posts related to a single subject, this series will have different shape for it's posts than other serieses.
for example a series posts have a verseId, chapterId, point_1, point_2, point_3.
another series posts may look like this: characterName, content.
I hope this is clear.
@Polar bear I want to archive the content for a scholar who sometimes writes a series of posts related to a single subject, this series will have different shape for it's posts than other serieses. for example a series posts have a `verseId, chapterId, point_1, point_2, point_3`. another series posts may look like this: ` characterName, content`. I hope this is clear.
you can do the same: think of a database schema, extend the objects if there are different types (or add a type key inside an object) and then save the data inside of it.

After you saved it you can load it and display it. To display these specific objects create different components that render them correctly.

An example data structure could look like this:
https://pastebin.com/wPFFuZkg
Answer
Sun bear
i think you can use dynamic data.
@Sun bear i think you can use dynamic data.
it is dynamic data 🙂
Sun bear
yeah, I meant datatype.
@Polar bear say I used prisma, then each series posts needs its own model?
That’s one option, yea. Another option would be to create only one „model“ (it’s a database table btw) and think about the fields that are required for every series. Then add all other fields and make them optional