Skip to content

Commit 980ea79

Browse files
committed
serve organzation list from route
1 parent 08c22a9 commit 980ea79

File tree

7 files changed

+297
-9
lines changed

7 files changed

+297
-9
lines changed

.husky/pre-commit

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
yarn prettier:write
2-
yarn lint --fix
1+
yarn run lint-staged

.lintstagedrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"*.ts": [
3+
"yarn run prettier:write",
4+
"yarn run lint --fix"
5+
]
6+
}

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"lint": "eslint . --ext .ts --cache",
1616
"prettier": "prettier --check src/*.ts src/**/*.ts",
1717
"prettier:write": "prettier --write src/*.ts src/**/*.ts",
18-
"prepare": "node .husky/install.mjs || true"
18+
"prepare": "node .husky/install.mjs || true",
19+
"lint-staged": "lint-staged"
1920
},
2021
"devDependencies": {
2122
"@tsconfig/node20": "^20.1.4",
@@ -29,12 +30,13 @@
2930
"eslint-import-resolver-typescript": "^3.6.1",
3031
"eslint-plugin-import": "^2.29.1",
3132
"eslint-plugin-prettier": "^5.2.1",
33+
"husky": "^9.1.4",
34+
"lint-staged": "^15.2.8",
3235
"prettier": "^3.3.3",
3336
"request": "^2.88.2",
3437
"synp": "^1.9.13",
3538
"tsx": "^4.16.5",
36-
"typescript": "^5.5.4",
37-
"husky": "^9.1.4"
39+
"typescript": "^5.5.4"
3840
},
3941
"dependencies": {
4042
"@aws-sdk/client-dynamodb": "^3.624.0",

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import eventsPlugin from "./routes/events.js";
1111
import cors from "@fastify/cors";
1212
import fastifyZodValidationPlugin from "./plugins/validate.js";
1313
import { environmentConfig } from "./config.js";
14+
import organizationsPlugin from "./routes/organizations.js";
1415

1516
const now = () => Date.now();
1617

@@ -64,6 +65,7 @@ async function init() {
6465
async (api, _options) => {
6566
api.register(protectedRoute, { prefix: "/protected" });
6667
api.register(eventsPlugin, { prefix: "/events" });
68+
api.register(organizationsPlugin, { prefix: "/organizations" });
6769
},
6870
{ prefix: "/api/v1" },
6971
);

src/orgs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const SIGList = [
1515
"SIGPLAN",
1616
"SIGPolicy",
1717
"SIGARCH",
18+
"SIGRobotics",
1819
] as const;
1920

2021
export const CommitteeList = [

src/routes/organizations.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { FastifyPluginAsync } from "fastify";
2+
import { OrganizationList } from "../orgs.js";
3+
4+
const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => {
5+
fastify.get("/", {}, async (request, reply) => {
6+
reply.send(OrganizationList);
7+
});
8+
};
9+
10+
export default organizationsPlugin;

0 commit comments

Comments
 (0)