Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: unify post data structure #91

Open
Drew-Macgibbon opened this issue Jul 5, 2023 · 1 comment
Open

util: unify post data structure #91

Drew-Macgibbon opened this issue Jul 5, 2023 · 1 comment

Comments

@Drew-Macgibbon
Copy link
Contributor

Drew-Macgibbon commented Jul 5, 2023

I will check the data structure of these blogs and create a unified data structure:

@Drew-Macgibbon
Copy link
Contributor Author

Working data structure:

export const NewsValidation = z.object({
  id: z.number(),
  created_at: z.string().nullable(), // need to use the date of actual post
  updated_at: z.string().nullable(), // need to use the date of actual post
  title: z.string().nullable(),
  link: z.string().nullable(),
  category_id: z.number(),
  tags: z.array(z.object({
    id: z.number().optional(),
    name: z.string()
  })).optional(),
  author: z.object({
    name: z.string(),
    link: z.string().nullable(),
    image: z.string().nullable()
  }).nullable().optional(),
  raw: z.object({
    title: z.string().nullable(),
    imageCaption: z.string().nullable(),
    credits: z.string().nullable(),
    imageAlt: z.string().nullable(),
    content: z.string().nullable()
  }).optional(),
  media: z.array(
    z.object({
      url: z.string().nullable(),
      alt: z.string().nullable(),
      caption: z.string().nullable()
    }).nullable().optional()
  ).nullable().optional(),
  summary: z.object({
    beginner: z.string().optional(),
    intermediate: z.string().optional(),
    expert: z.string().optional()
  })
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant