Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into bug-code-cell-outlines
Browse files Browse the repository at this point in the history
  • Loading branch information
ddimaria committed Dec 1, 2023
2 parents 0feea9e + 507cb44 commit 0b7fba5
Show file tree
Hide file tree
Showing 17 changed files with 2,816 additions and 37,134 deletions.
11 changes: 11 additions & 0 deletions quadratic-api/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off"
},
"ignorePatterns": ["node_modules/*"]
}
7 changes: 7 additions & 0 deletions quadratic-api/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"printWidth": 120
}
2,948 changes: 2,678 additions & 270 deletions quadratic-api/package-lock.json

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions quadratic-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"scripts": {
"start": "dotenv -e .env -- ts-node-dev --respawn --exit-child --watch src --project ./tsconfig.json ./src/server.ts ",
"build": "tsc",
"lint": "eslint src/**/*.ts",
"format": "eslint src/**/*.ts --fix",
"pretty": "prettier --write \"src/**/*.ts\"",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint src/**/*.ts",
"lint:eslint:write": "eslint src/**/*.ts --fix",
"lint:prettier": "prettier --check \"src/**/*.ts\"",
"lint:prettier:write": "prettier --write \"src/**/*.ts\"",
"prisma:migrate": "npx prisma migrate dev",
"prisma:migrate:create": "npx prisma migrate dev --create-only",
"docker:up": "docker-compose up -d && sleep 1",
Expand Down Expand Up @@ -49,7 +51,6 @@
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^5.1.6",
"zod": "^3.21.4"
},
"devDependencies": {
Expand All @@ -60,8 +61,13 @@
"@types/cors": "^2.8.12",
"@types/multer": "^1.4.8",
"@types/multer-s3": "^3.0.1",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"dotenv-cli": "^7.1.0",
"prisma": "^4.12.0"
"eslint": "^8.54.0",
"prettier": "^3.1.0",
"prisma": "^4.12.0",
"typescript": "^5.3.2"
},
"engines": {
"node": "18.x"
Expand Down
2 changes: 1 addition & 1 deletion quadratic-api/src/routes/ai_chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ai_rate_limiter = rateLimit({
max: Number(process.env.RATE_LIMIT_AI_REQUESTS_MAX) || 25, // Limit number of requests per windowMs
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
keyGenerator: (request: Request, response) => {
keyGenerator: (request: Request) => {
return request.auth?.sub || 'anonymous';
},
});
Expand Down
1 change: 1 addition & 0 deletions quadratic-api/src/routes/files/fileMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import dbClient from '../../dbClient';
import { Request } from '../../types/Request';

export const fileMiddleware = async (req: Request, res: Response, next: NextFunction) => {
// TODO: validate UUID
if (req.params.uuid === undefined) {
return res.status(400).json({ error: { message: 'Invalid file UUID' } });
}
Expand Down
6 changes: 3 additions & 3 deletions quadratic-api/src/routes/files/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,10 @@ describe('UPDATE - POST /v0/files/:uuid/thumbnail with auth and owned file updat
.attach('thumbnail', filePath)
.set('Accept', 'application/json')
.set('Content-Type', 'multipart/form-data')
.set('Authorization', `Bearer ValidToken test_user_1`)
// .expect(200); // OK
.set('Authorization', `Bearer ValidToken test_user_1`);
// .expect(200); // OK

// expect(res.body).toMatchObject({ message: 'Preview updated' });
// TODO fix test with mocks
});
});
});
Loading

0 comments on commit 0b7fba5

Please sign in to comment.