Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
99dbfeb
refactor: rename `authentication.getAuthenticatedUser()` to `authenti…
AlAnNuB Mar 25, 2026
2bd6992
refactor: explicitly return in `/api/v1/status` `GET` handler
AlAnNuB Mar 25, 2026
39c57f1
test: standardize test descriptions with backticks (`)
AlAnNuB Mar 25, 2026
abff198
test: replace hardcoded `http://localhost:3000` with `${webserver.ori…
AlAnNuB Mar 25, 2026
188f027
chore: move `dotenv` and `dotenv-expand` to `devDependencies`
AlAnNuB Mar 25, 2026
b830a99
refactor: remove `async` from `setSessionCookie()` and `clearSessionC…
AlAnNuB Mar 25, 2026
c9beb0f
test: fix ISO date format in `authorization` unit tests
AlAnNuB Mar 25, 2026
5771678
test: replace "Retrieving" with "Running" in `POST /api/v1/migrations…
AlAnNuB Mar 25, 2026
a1b9f27
test: assert `email` is updated in database after `PATCH /api/v1/user…
AlAnNuB Mar 25, 2026
6e94330
refactor: inline `createRouter()` chain in all API route exports
AlAnNuB Mar 25, 2026
f1032e4
refactor: make `orchestrator.createSession()` accept `user` object
AlAnNuB Mar 25, 2026
df347ec
test: clear database and run migrations in `GET /api/v1/status` tests
AlAnNuB Mar 25, 2026
351ab70
test: add default user coverage for `GET /api/v1/status`
AlAnNuB Mar 25, 2026
53a0657
feat: add `sameSite=Lax` to `controller.setSessionCookie()`
AlAnNuB Mar 25, 2026
91ac0d5
test: tolerate small timestamp drift in `POST /api/v1/sessions` tests
AlAnNuB Mar 25, 2026
aca6e65
chore: bump project dependencies within `minor` and `patch` releases
AlAnNuB Mar 25, 2026
be2bb3a
chore: upgrade `major` dependencies that required no code changes
AlAnNuB Mar 25, 2026
f76234c
chore: upgrade `next`, `react` and `eslint` to latest compatible vers…
AlAnNuB Mar 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .eslintrc.json

This file was deleted.

55 changes: 55 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import js from "@eslint/js";
import globals from "globals";
import json from "@eslint/json";
import markdown from "@eslint/markdown";
import css from "@eslint/css";
import { defineConfig } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import jest from "eslint-plugin-jest";
import prettier from "eslint-config-prettier/flat";

export default defineConfig([
{
files: ["**/*.{js,mjs,cjs,jsx}"],
plugins: { js },
extends: ["js/recommended"],
languageOptions: { globals: { ...globals.browser, ...globals.node } },
},
...nextVitals,
{
files: ["tests/**/*.test.js"],
...jest.configs["flat/recommended"],
},
{
files: ["**/*.json"],
plugins: { json },
language: "json/json",
extends: ["json/recommended"],
ignores: ["package-lock.json"],
},
{
files: ["**/*.jsonc"],
plugins: { json },
language: "json/jsonc",
extends: ["json/recommended"],
},
{
files: ["**/*.json5"],
plugins: { json },
language: "json/json5",
extends: ["json/recommended"],
},
{
files: ["**/*.md"],
plugins: { markdown },
language: "markdown/gfm",
extends: ["markdown/recommended"],
},
{
files: ["**/*.css"],
plugins: { css },
language: "css/css",
extends: ["css/recommended"],
},
prettier,
]);
5 changes: 3 additions & 2 deletions infra/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ function onErrorHandler(error, request, response) {
response.status(publicErrorObject.statusCode).json(publicErrorObject);
}

async function setSessionCookie(sessionToken, response) {
function setSessionCookie(sessionToken, response) {
const setCookie = cookie.serialize("session_id", sessionToken, {
path: "/",
maxAge: session.EXPIRATION_IN_MILLISECONDS / 1000,
secure: process.env.NODE_ENV === "production",
httpOnly: true,
sameSite: "Lax",
});

response.setHeader("Set-Cookie", setCookie);
}

async function clearSessionCookie(response) {
function clearSessionCookie(response) {
const setCookie = cookie.serialize("session_id", "invalid", {
path: "/",
maxAge: -1,
Expand Down
4 changes: 2 additions & 2 deletions models/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import user from "models/user.js";
import password from "models/password.js";
import { NotFoundError, UnauthorizedError } from "infra/errors.js";

async function getAuthenticatedUser(providedEmail, providedPassword) {
async function getUser(providedEmail, providedPassword) {
try {
const storedUser = await findUserByEmail(providedEmail);
await validatePassword(providedPassword, storedUser.password);
Expand Down Expand Up @@ -53,7 +53,7 @@ async function getAuthenticatedUser(providedEmail, providedPassword) {
}

const authentication = {
getAuthenticatedUser,
getUser,
};

export default authentication;
Loading
Loading