Create a Content Management System (CMS)
Let’s consider the following scenario for this project. The administrators of your organization would like to maintain all the organization’s content, including blog posts and image posts, in your organization’s application.
The posts have the following shape:
interface IBlogPost {
id: number;
title: string;
description: string;
viewCount: number;
publishedAt: string;
}
interface IImagePost {
id: number;
imageUrl: string;
caption: string;
comments: Array<string>;
publishedAt: string;
}
The administrators’ requirements for how the content should be organized are as follows:
Hint: Think about using a generic search function that can accept an array of these properties.
null
and undefined
properties explicitly.Hint: This will require a bit more work than rendering just two radio buttons.
Object.keys()
to acheive the desired UI.
The administrators don’t really understand the concept of ‘truthy’ and ‘falsy’ and would like the labels for the filters to be renamed to is provided
and is not provided
. This feature will allow them to quickly find and fix data that has missing values.Hint: This requires nothing more than a text refactor.
publishedAt
property should conform to the ISO 8601 standard, and so you may use new Date(aBlogPost.publishedAt
) and new Date(aImagePost.publishedAt
). However, wrap these conversions in a try
/ catch
statement to prepare for the possibility that the API could sometimes incorrectly format the datetime strings.Hint: Defining a utility function that can do this may be useful here since it can be reused throughout the application.