|
|
|
@ -75,34 +75,35 @@ export async function getExecNames() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export async function getExec(fileName: string, convert = true) { |
|
|
|
|
const posDict: { [name: string]: string } = { |
|
|
|
|
"01": "President", |
|
|
|
|
"02": "Vice President", |
|
|
|
|
"03": "Assistant Vice President", |
|
|
|
|
"04": "Treasurer", |
|
|
|
|
"05": "Systems Administrator", |
|
|
|
|
}; |
|
|
|
|
// const posDict: { [name: string]: string } = {
|
|
|
|
|
// "01": "President",
|
|
|
|
|
// "02": "Vice President",
|
|
|
|
|
// "03": "Assistant Vice President",
|
|
|
|
|
// "04": "Treasurer",
|
|
|
|
|
// "05": "Systems Administrator",
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
const firstName = |
|
|
|
|
fileName.split("-")[1][0].toUpperCase() + fileName.split("-")[1].slice(1); |
|
|
|
|
const lastName = |
|
|
|
|
fileName.split("-")[2][0].toUpperCase() + fileName.split("-")[2].slice(1); |
|
|
|
|
const posOrder = fileName.split("-")[0]; |
|
|
|
|
const pos = posDict[posOrder]; |
|
|
|
|
// const firstName =
|
|
|
|
|
// fileName.split("-")[1][0].toUpperCase() + fileName.split("-")[1].slice(1);
|
|
|
|
|
// const lastName =
|
|
|
|
|
// fileName.split("-")[2][0].toUpperCase() + fileName.split("-")[2].slice(1);
|
|
|
|
|
// const posOrder = fileName.split("-")[0];
|
|
|
|
|
// const pos = posDict[posOrder];
|
|
|
|
|
|
|
|
|
|
let content, metadata; |
|
|
|
|
// let content, metadata;
|
|
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
const raw = await readFile(path.join(EXECS_PATH, `${fileName}${fileType}`)); |
|
|
|
|
({ content, data: metadata } = matter(raw)); |
|
|
|
|
const raw = await readFile(path.join(EXECS_PATH, `${fileName}${fileType}`)); |
|
|
|
|
const { content, data: metadata } = matter(raw); |
|
|
|
|
|
|
|
|
|
const image = |
|
|
|
|
(metadata.image as string | undefined) ?? |
|
|
|
|
(await getMemberImagePath(metadata.name)); |
|
|
|
|
const image = |
|
|
|
|
(metadata.image as string | undefined) ?? |
|
|
|
|
(await getMemberImagePath(metadata.name)); |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
content: convert ? await serialize(content) : content, |
|
|
|
|
metadata: { ...metadata, image } as Metadata, |
|
|
|
|
return { |
|
|
|
|
content: convert ? await serialize(content) : content, |
|
|
|
|
metadata: { ...metadata, image } as Metadata, |
|
|
|
|
}; |
|
|
|
|
// };
|
|
|
|
|
// } catch (err) {
|
|
|
|
|
// console.log(err);
|
|
|
|
|