mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-01-17 09:54:08 +00:00
Signed-off-by: Traxus <shyidx@gmail.com>
This commit is contained in:
parent
08d0fcdc48
commit
01f7081476
@ -185,7 +185,7 @@ function jsonNodeExists(jsonData : object, node : string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function jsonNodesExist(jsonData : object, nodes : array) {
|
||||
function jsonNodesExist(jsonData : object, nodes : string[]) {
|
||||
//-----permit basic validation of the json we are trying to spit out by checking for existence of first order nodes
|
||||
|
||||
let node = '';
|
||||
@ -224,7 +224,7 @@ function jsonNodesExist(jsonData : object, nodes : array) {
|
||||
|
||||
}
|
||||
|
||||
export async function getJsonItemsFromDirectory(jsonDirectory : string, pluckerFunction : any, validationNodes : array) {
|
||||
export async function getJsonItemsFromDirectory(jsonDirectory : string, pluckerFunction : any, validationNodes : string[]) {
|
||||
let jsonFiles = await fs.readdir(jsonDirectory);
|
||||
let returnJson = [];
|
||||
|
||||
@ -266,7 +266,7 @@ function getBlogJsonDirectoryPath() {
|
||||
return path.join(process.cwd(), 'json/site_content/blogPost');
|
||||
}
|
||||
|
||||
function pluckBlogPostData(json : object) {
|
||||
function pluckBlogPostData(json : any) {
|
||||
|
||||
let plucked = {};
|
||||
|
||||
@ -299,7 +299,7 @@ function getRequiedBlogPostNodes() : string[] {
|
||||
|
||||
}
|
||||
|
||||
function forceBlogPostsJsonSlugIntegrity(json : object) {
|
||||
function forceBlogPostsJsonSlugIntegrity(json : any) {
|
||||
//-----this is used to force the blog post slug to match that of its parent file name.
|
||||
|
||||
let returnJson = [];
|
||||
@ -316,14 +316,14 @@ function forceBlogPostsJsonSlugIntegrity(json : object) {
|
||||
|
||||
}
|
||||
|
||||
function sortBlogPostsJsonByDate(json : object) {
|
||||
function sortBlogPostsJsonByDate(json : any) {
|
||||
|
||||
let sortedJson = json.slice().sort((a, b) => datocmsDateToIng(b.date) - datocmsDateToIng(a.date));
|
||||
|
||||
return sortedJson;
|
||||
}
|
||||
|
||||
function getFakePaginationData(json : object) {
|
||||
function getFakePaginationData(json : any) {
|
||||
|
||||
let pagination = {};
|
||||
let totalPosts = json.length;
|
||||
@ -337,7 +337,7 @@ function getFakePaginationData(json : object) {
|
||||
return pagination;
|
||||
}
|
||||
|
||||
async function getAllBlogPostsJson() : object {
|
||||
async function getAllBlogPostsJson() {
|
||||
let jsonDirectory = getBlogJsonDirectoryPath();
|
||||
let validationNodes = getRequiedBlogPostNodes();
|
||||
let blogPosts = await getJsonItemsFromDirectory(jsonDirectory, pluckBlogPostData, validationNodes);
|
||||
@ -368,7 +368,7 @@ export async function getAllBlogPostsSlugsFromSource() {
|
||||
|
||||
}
|
||||
|
||||
export async function getAllBlogPostsFromSource(datocmsFilters : object) {
|
||||
export async function getAllBlogPostsFromSource(datocmsFilters : any) {
|
||||
let allBlogPostsFromSource = {};
|
||||
|
||||
if (process.env.NEXT_PUBLIC_DATOCMS_BYPASS_TYPE === "local_json") {
|
||||
@ -436,7 +436,7 @@ export async function getSingleBlogPostBySlugFromSource(slug : string) {
|
||||
|
||||
}
|
||||
|
||||
function getBlogPostCategorySlugs(blogPostJson : object) {
|
||||
function getBlogPostCategorySlugs(blogPostJson : any) {
|
||||
|
||||
let categories = [];
|
||||
|
||||
@ -457,7 +457,7 @@ function getBlogPostCategorySlugs(blogPostJson : object) {
|
||||
|
||||
}
|
||||
|
||||
export async function getRelatedBlogPosts(blogPostJson : object, matchCount : number) {
|
||||
export async function getRelatedBlogPosts(blogPostJson : any, matchCount : number) {
|
||||
|
||||
let relatedBlogPosts = [];
|
||||
let reservedSlugs = []
|
||||
@ -519,7 +519,7 @@ function getBlogCategoriesJsonDirectoryPath() {
|
||||
return path.join(process.cwd(), 'json/site_content/category');
|
||||
}
|
||||
|
||||
function pluckBlogCategoriesData(json : object) {
|
||||
function pluckBlogCategoriesData(json : any) {
|
||||
|
||||
let plucked = {};
|
||||
|
||||
@ -544,7 +544,7 @@ function getRequiedBlogBlogCategoryNodes() {
|
||||
|
||||
}
|
||||
|
||||
export async function getAllBlogCategoriesJson() : object {
|
||||
export async function getAllBlogCategoriesJson() : any {
|
||||
let jsonDirectory = getBlogCategoriesJsonDirectoryPath();
|
||||
let validationNodes = getRequiedBlogBlogCategoryNodes();
|
||||
let allBlogCategoriesJson = await getJsonItemsFromDirectory(jsonDirectory, pluckBlogCategoriesData, validationNodes)
|
||||
@ -573,7 +573,7 @@ function getEventsJsonDirectoryPath() {
|
||||
return path.join(process.cwd(), 'json/site_content/event');
|
||||
}
|
||||
|
||||
function pluckEventData(json : object) {
|
||||
function pluckEventData(json : any) {
|
||||
|
||||
let plucked = {};
|
||||
|
||||
@ -600,14 +600,14 @@ function getRequiedEventNodes() {
|
||||
|
||||
}
|
||||
|
||||
function sortEventsJsonByStartDate(json : object) {
|
||||
function sortEventsJsonByStartDate(json : any) {
|
||||
|
||||
let sortedJson = json.slice().sort((a, b) => datocmsDateToIng(b.eventStartdate) - datocmsDateToIng(a.eventStartdate));
|
||||
|
||||
return sortedJson;
|
||||
}
|
||||
|
||||
async function getAllEventsJson() : object {
|
||||
async function getAllEventsJson() : any {
|
||||
let jsonDirectory = getEventsJsonDirectoryPath();
|
||||
let validationNodes = getRequiedEventNodes();
|
||||
let events = await getJsonItemsFromDirectory(jsonDirectory, pluckEventData, validationNodes);
|
||||
@ -623,7 +623,7 @@ function getPositionsJsonDirectoryPath() {
|
||||
return path.join(process.cwd(), 'json/site_content/position');
|
||||
}
|
||||
|
||||
function pluckPositionData(json : object) {
|
||||
function pluckPositionData(json : any) {
|
||||
|
||||
let plucked = {};
|
||||
|
||||
@ -649,14 +649,14 @@ function getRequiedPositionNodes() {
|
||||
|
||||
}
|
||||
|
||||
function sortPositionsJsonById(json : object) {
|
||||
function sortPositionsJsonById(json : any) {
|
||||
|
||||
let sortedJson = json.slice().sort((a, b) => parseInt(a.id) - parseInt(b.id));
|
||||
|
||||
return sortedJson;
|
||||
}
|
||||
|
||||
async function getAllPositionsJson() : object {
|
||||
async function getAllPositionsJson() {
|
||||
let jsonDirectory = getPositionsJsonDirectoryPath();
|
||||
let validationNodes = getRequiedPositionNodes();
|
||||
let positions = await getJsonItemsFromDirectory(jsonDirectory, pluckPositionData, validationNodes);
|
||||
@ -672,7 +672,7 @@ function getPressReleasesJsonDirectoryPath() {
|
||||
return path.join(process.cwd(), 'json/site_content/pressRelease');
|
||||
}
|
||||
|
||||
function pluckPressReleaseData(json : object) {
|
||||
function pluckPressReleaseData(json : any) {
|
||||
|
||||
let plucked = {};
|
||||
|
||||
@ -699,14 +699,14 @@ function getRequiedPressReleaseNodes() {
|
||||
|
||||
}
|
||||
|
||||
function sortPressReleasesJsonByDate(json : object) {
|
||||
function sortPressReleasesJsonByDate(json : any) {
|
||||
|
||||
let sortedJson = json.slice().sort((a, b) => datocmsDateToIng(b.date) - datocmsDateToIng(a.date));
|
||||
|
||||
return sortedJson;
|
||||
}
|
||||
|
||||
async function getAllPressReleasesJson() : object {
|
||||
async function getAllPressReleasesJson() {
|
||||
let jsonDirectory = getPressReleasesJsonDirectoryPath();
|
||||
let validationNodes = getRequiedPressReleaseNodes();
|
||||
let pressReleases = await getJsonItemsFromDirectory(jsonDirectory, pluckPressReleaseData, validationNodes);
|
||||
@ -722,7 +722,7 @@ function getTeamsJsonDirectoryPath() {
|
||||
return path.join(process.cwd(), 'json/site_content/team');
|
||||
}
|
||||
|
||||
function pluckTeamData(json : object) {
|
||||
function pluckTeamData(json : any) {
|
||||
|
||||
let plucked = {};
|
||||
|
||||
@ -747,14 +747,14 @@ function getRequiedTeamNodes() {
|
||||
|
||||
}
|
||||
|
||||
function sortTeamsJsonById(json : object) {
|
||||
function sortTeamsJsonById(json : any) {
|
||||
|
||||
let sortedJson = json.slice().sort((a, b) => parseInt(a.id) - parseInt(b.id));
|
||||
|
||||
return sortedJson;
|
||||
}
|
||||
|
||||
async function getAllTeamsJson() : object {
|
||||
async function getAllTeamsJson() : any {
|
||||
let jsonDirectory = getTeamsJsonDirectoryPath();
|
||||
let validationNodes = getRequiedTeamNodes();
|
||||
let teams = await getJsonItemsFromDirectory(jsonDirectory, pluckTeamData, validationNodes);
|
||||
@ -770,7 +770,7 @@ function getTestimonialsJsonDirectoryPath() {
|
||||
return path.join(process.cwd(), 'json/site_content/testimonial');
|
||||
}
|
||||
|
||||
function pluckTestimonialData(json : object) {
|
||||
function pluckTestimonialData(json : any) {
|
||||
|
||||
let plucked = {};
|
||||
|
||||
@ -797,14 +797,14 @@ function getRequiedTestimonialNodes() {
|
||||
|
||||
}
|
||||
|
||||
function sortTestimonialsJsonById(json : object) {
|
||||
function sortTestimonialsJsonById(json : any) {
|
||||
|
||||
let sortedJson = json.slice().sort((a, b) => parseInt(a.id) - parseInt(b.id));
|
||||
|
||||
return sortedJson;
|
||||
}
|
||||
|
||||
async function getAllTestimonialsJson() : object {
|
||||
async function getAllTestimonialsJson() : any {
|
||||
let jsonDirectory = getTestimonialsJsonDirectoryPath();
|
||||
let validationNodes = getRequiedTestimonialNodes();
|
||||
let testimonials = await getJsonItemsFromDirectory(jsonDirectory, pluckTestimonialData, validationNodes);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user