Skip to content

WIP: added more options in meta on creation of schedule#5

Merged
PriyanshuPz merged 2 commits intomasterfrom
preprod
Oct 3, 2025
Merged

WIP: added more options in meta on creation of schedule#5
PriyanshuPz merged 2 commits intomasterfrom
preprod

Conversation

@PriyanshuPz
Copy link
Member

@PriyanshuPz PriyanshuPz commented Sep 30, 2025

related: Post0HQ/studio#7

This pull request introduces support for enhanced post metadata in the scheduling workflow, including structured validation and parsing of post types, prompts, and Unsplash tags. The changes add new schema definitions, update DTOs, and ensure metadata is consistently stored and validated throughout the scheduling process.

Metadata schema and parsing improvements:

  • Added src/lib/prism_json.ts to define strict schemas for post metadata using zod, supporting multiple schema versions and providing a unified parsing function (parseJsonV).
  • Updated ScheduleService to use the new schema for validating and storing metadata in contentParams and metadata fields. [1] [2] [3]

DTO and type enhancements:

  • Added PostType enum and corresponding fields (postType, prompt, unsplashTags) to CreateScheduleDto, ensuring type safety and validation for new metadata properties. [1] [2]

Service integration updates:

  • Modified ScheduleService to extract and handle new metadata fields from CreateScheduleDto when creating schedules and schedule times.
  • Minor code cleanup in ScheduleService to ensure user-based schedule access remains enforced.

@PriyanshuPz
Copy link
Member Author

@mdkaifansari04 You can use this schema and metadata field in post model

export const JSON_PARSER = {
  'sch.0.1': {
    version: 'sch.0.1',
    schema: z.object({
      version: z.literal('sch.0.1'),
      postType: z.string(),
      prompt: z.string().optional(),
      unsplashTags: z.array(z.string()).optional(),
    }),
    parse: (data: any) => {
      return JSON_PARSER['sch.0.1'].schema.parse(data);
    },
  },
}

@PriyanshuPz PriyanshuPz merged commit 6d4d36a into master Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants