autonomous.contact/models/session.ts

26 lines
563 B
TypeScript

import { FSDB_COLLECTION } from 'jsr:@andyburke/fsdb';
import { FSDB_INDEXER_SYMLINKS } from 'jsr:@andyburke/fsdb/indexers';
import { by_lurid } from 'jsr:@andyburke/fsdb/organizers';
export type SESSION = {
id: string;
user_id: string;
secret: string;
timestamps: {
created: string;
expires: string;
ended: string;
};
};
export const SESSIONS = new FSDB_COLLECTION<SESSION>({
name: 'sessions',
indexers: {
user_id: new FSDB_INDEXER_SYMLINKS<SESSION>({
name: 'user_id',
field: 'user_id',
to_many: true,
organize: by_lurid
})
}
});