Change returned data type
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
6e8f7bba94
commit
fbcdec33eb
34
lib/team.ts
34
lib/team.ts
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import { readFile, readdir, access } from "fs/promises";
|
import { readFile, readdir, access } from "fs/promises";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
|
@ -11,18 +12,17 @@ const EXECS_PATH = path.join("content", "team", "execs");
|
||||||
const fileType = ".md";
|
const fileType = ".md";
|
||||||
const { year, term } = getCurrentTerm();
|
const { year, term } = getCurrentTerm();
|
||||||
|
|
||||||
|
export interface execMembers {
|
||||||
|
name: string;
|
||||||
|
order: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Metadata {
|
export interface Metadata {
|
||||||
name: string;
|
name: string;
|
||||||
role: string;
|
role: string;
|
||||||
image: string;
|
image: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export async function getExecNames() {
|
|
||||||
// return (await readdir(EXECS_PATH))
|
|
||||||
// .filter((name) => name.endsWith(fileType))
|
|
||||||
// .map((name) => name.slice(0, -1 * fileType.length));
|
|
||||||
// }
|
|
||||||
|
|
||||||
export async function getExecNames() {
|
export async function getExecNames() {
|
||||||
if (process.env.USE_LDAP?.toLowerCase() !== "true") {
|
if (process.env.USE_LDAP?.toLowerCase() !== "true") {
|
||||||
return (await readdir(EXECS_PATH))
|
return (await readdir(EXECS_PATH))
|
||||||
|
@ -44,12 +44,30 @@ export async function getExecNames() {
|
||||||
)}${year})(exec=True))`,
|
)}${year})(exec=True))`,
|
||||||
});
|
});
|
||||||
|
|
||||||
const execMembers = searchEntries.map((item) => item.cn as string);
|
let execMembers: execMembers[] = [];
|
||||||
|
|
||||||
|
execMembers = searchEntries
|
||||||
|
.map((item) => {
|
||||||
|
return {
|
||||||
|
name: item.cn as string,
|
||||||
|
order: item.order as string,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((item1: execMembers, item2: execMembers) =>
|
||||||
|
item1.order.localeCompare(item2.order)
|
||||||
|
);
|
||||||
|
|
||||||
|
const formattedExec: string[] = execMembers.map(
|
||||||
|
(member) =>
|
||||||
|
`0${member.order}-
|
||||||
|
${member.name.split(" ")[1].toLowerCase()}-
|
||||||
|
${member.name.split(" ")[0].toLowerCase()}`
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
await client.unbind();
|
await client.unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
return execMembers;
|
return formattedExec;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getExec(fileName: string, convert = true) {
|
export async function getExec(fileName: string, convert = true) {
|
||||||
|
|
Loading…
Reference in New Issue