Skip to content

Commit

Permalink
Archive FA24 and Add Script to Generate JSON (#809)
Browse files Browse the repository at this point in the history
### Summary <!-- Required -->

Archive all active members from Fall 2024 into `fa24.json`.

Add a script to do this, runnable through
```
yarn workspace backend run create-member-archive <semester>
```

i.e.
```
yarn workspace backend run create-member-archive fa24
```

<!-- Optional: If adding/updating endpoints, update the backend api
specification (openapi.yaml) -->

### Notion/Figma Link <!-- Optional -->

<!-- If the changes have associated Notion pages/Figma design(s), please
include the links here.-->

### Test Plan <!-- Required -->
Ran the above command to generate the archive.

### Notes <!-- Optional -->

<!--- List any important or subtle points, future considerations, or
other items of note. -->

### Breaking Changes <!-- Optional -->

<!-- Keep items that apply: -->
  • Loading branch information
andrew032011 authored Dec 31, 2024
1 parent 2dfeebc commit 7d06e15
Show file tree
Hide file tree
Showing 4 changed files with 7,528 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"create-idol-images-pr": "esr scripts/create-idol-images-pr.ts",
"backup-prod-db": "esr scripts/backup-prod-db.ts",
"restore-from-backup": "esr scripts/restore-from-backup.ts",
"shoutout-leaderboard": "esr scripts/shoutout-leaderboard.ts"
"shoutout-leaderboard": "esr scripts/shoutout-leaderboard.ts",
"create-member-archive": "esr scripts/create-member-archive.ts"
},
"license": "AGPL-3.0",
"dependencies": {
Expand Down
18 changes: 18 additions & 0 deletions backend/scripts/create-member-archive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as fs from 'fs';
import { approvedMemberCollection } from '../src/firebase';

const semester = process.argv[2];

if (!semester) {
// eslint-disable-next-line no-console
console.error('Please provide a semester identifier (e.g., fa24) as an argument');
process.exit(1);
}

approvedMemberCollection.get().then(async (colRef) => {
const members = await Promise.all(colRef.docs.map((doc) => doc.data()));
fs.writeFileSync(
`src/members-archive/${semester}.json`,
JSON.stringify({ members }, undefined, 2)
);
});
Loading

0 comments on commit 7d06e15

Please sign in to comment.