Skip to content

Commit 0f3a6c8

Browse files
committed
mv ./lib/session.js ./lib/session/index.js
1 parent a2746b1 commit 0f3a6c8

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Local tests expect MySQL plus the NicTool schema. CI initializes it with `sh sql
2323
- `lib/<resource>/index.js` is usually a backend selector. The active implementation comes from `NICTOOL_DATA_STORE` and defaults to MySQL; some resources also support TOML, MongoDB, or Elasticsearch backends.
2424
- The real persistence logic lives under `lib/<resource>/store/*.js`. These stores translate between API-friendly field names and the legacy NicTool schema (`nt_*` columns), using helpers like `mapToDbColumn`, `objectToDb`, and `dbToObject`.
2525
- `lib/mysql.js` is the shared query builder/executor. Repositories rely on it for SQL generation rather than embedding ad hoc parameter handling in route files.
26-
- Auth is session-backed but bearer-token based: `POST /session` authenticates through the user repo, creates an `nt_user_session` row via `lib/user/session.js`, and returns a JWT. Almost every other route runs under the default JWT auth strategy.
26+
- Auth is session-backed but bearer-token based: `POST /session` authenticates through the session repo, creates an `nt_user_session` row via `lib/session/index.js`, and returns a JWT. Almost every other route runs under the default JWT auth strategy.
2727
- Group, user, and permission behavior is coupled. Group creation also creates a group-level permission row, user reads attach effective permissions, and permission resolution falls back from explicit user permissions to group permissions.
2828
- DNS data has an extra translation layer. `lib/zone_record/store/mysql.js` validates records with `@nictool/dns-resource-record` and maps NicTool’s legacy zone-record columns to RFC-style record fields.
2929
- Config comes from `conf.d/*.toml`, with runtime overrides from `NICTOOL_DB_*` and `NICTOOL_HTTP_*`. `lib/config.js` also auto-loads TLS material from any `.pem` file in `conf.d/`.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import assert from 'node:assert/strict'
22
import { describe, it, after, before } from 'node:test'
33

4-
import User from '../index.js'
5-
import Session from '../session.js'
6-
import userCase from './user.json' with { type: 'json' }
4+
import User from '../../user/index.js'
5+
import Session from '../index.js'
6+
import userCase from '../../user/test/user.json' with { type: 'json' }
77

88
const sessionUser = {
99
...userCase,

routes/session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Config from '../lib/config.js'
44
import Jwt from '@hapi/jwt'
55

66
import User from '../lib/user/index.js'
7-
import Session from '../lib/user/session.js'
7+
import Session from '../lib/session/index.js'
88

99
import { meta } from '../lib/util.js'
1010

test-fixtures.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'node:path'
44

55
import Group from './lib/group/index.js'
66
import User from './lib/user/index.js'
7-
import Session from './lib/user/session.js'
7+
import Session from './lib/session/index.js'
88
import Permission from './lib/permission/index.js'
99
import Nameserver from './lib/nameserver/index.js'
1010
import Zone from './lib/zone/index.js'

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ else
3030
# npm i --no-save node-test-github-reporter
3131
# $NODE --test --test-reporter=node-test-github-reporter
3232
# fi
33-
$NODE --test --test-reporter=spec lib/*/test/*.js lib/*.test.js routes/*.test.js
33+
$NODE --test --test-reporter=spec lib/*/test/index.js lib/*.test.js routes/*.test.js
3434
fi

0 commit comments

Comments
 (0)