#7 - Added new Type definition and filter by status where we are on dev or prod #8

Merged
giacchetta merged 1 commits from 7-filter-blog-post-status into main 2025-08-08 17:59:02 -03:00
Owner

The core/src/libs/posts.ts file has been updated to correctly fetch and filter posts from Directus based on the environment.

  • The readItems call now explicitly requests all the fields specified in the codyops_post data model: slug, status, sort, user_created, user_updated, date_created, date_updated, title, description, tags, cover_image, and content.
  • A filter has been implemented to control post visibility:
    • In DEV mode (checked via import.meta.env.DEV), posts with a status not equal to 'archived' will be retrieved.
    • In PROD mode, only posts with a status equal to 'published' will be retrieved.
  • The necessary TypeScript interfaces (Post and DirectusSchema) have been defined in core/src/types/codyops-post.ts to provide proper type checking for the Directus SDK calls.
The `core/src/libs/posts.ts` file has been updated to correctly fetch and filter posts from Directus based on the environment. - The `readItems` call now explicitly requests all the fields specified in the `codyops_post` data model: `slug`, `status`, `sort`, `user_created`, `user_updated`, `date_created`, `date_updated`, `title`, `description`, `tags`, `cover_image`, and `content`. - A filter has been implemented to control post visibility: - In `DEV` mode (checked via `import.meta.env.DEV`), posts with a `status` not equal to `'archived'` will be retrieved. - In `PROD` mode, only posts with a `status` equal to `'published'` will be retrieved. - The necessary TypeScript interfaces (`Post` and `DirectusSchema`) have been defined in `core/src/types/codyops-post.ts` to provide proper type checking for the Directus SDK calls.
giacchetta added 1 commit 2025-08-08 17:49:19 -03:00
#7 - Added new Type definition and filter by status where we are on dev or prod
All checks were successful
CodyOps Core Builder / build-conteiner (pull_request) Successful in 2m55s
8e6c810d57
giacchetta merged commit dea6ab6823 into main 2025-08-08 17:59:02 -03:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: codyops/core#8
No description provided.