feature: initial commit

This commit is contained in:
Andy Burke 2025-06-24 15:40:30 -07:00
commit 2c27f003c9
15 changed files with 1601 additions and 0 deletions

16
models/password_entry.ts Normal file
View file

@ -0,0 +1,16 @@
import { FSDB_COLLECTION } from 'jsr:@andyburke/fsdb';
export type PASSWORD_ENTRY = {
user_id: string;
hash: string;
salt: string;
timestamps: {
created: string;
updated: string;
};
};
export const PASSWORD_ENTRY_STORE = new FSDB_COLLECTION<PASSWORD_ENTRY>({
name: 'password_entries',
id_field: 'user_id'
});

25
models/session.ts Normal file
View file

@ -0,0 +1,25 @@
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',
organize: by_lurid
})
}
});

15
models/totp_entry.ts Normal file
View file

@ -0,0 +1,15 @@
import { FSDB_COLLECTION } from 'jsr:@andyburke/fsdb';
export type TOTP_ENTRY = {
user_id: string;
secret: string;
timestamps: {
created: string;
updated: string;
};
};
export const TOTP_ENTRY_STORE = new FSDB_COLLECTION<TOTP_ENTRY>({
name: 'totp_entries',
id_field: 'user_id'
});

37
models/user.ts Normal file
View file

@ -0,0 +1,37 @@
import { FSDB_COLLECTION } from 'jsr:@andyburke/fsdb';
import { FSDB_INDEXER_SYMLINKS } from 'jsr:@andyburke/fsdb/indexers';
import { by_character } from 'jsr:@andyburke/fsdb/organizers';
export type USER = {
id: string;
username: string;
timestamps: {
created: string;
updated: string;
};
};
export const USER_STORE = new FSDB_COLLECTION<USER>({
name: 'users',
indexers: {
// email: new FSDB_INDEXER_SYMLINKS<USER>({
// name: 'email',
// field: 'email',
// organize: by_email
// }),
username: new FSDB_INDEXER_SYMLINKS<USER>({
name: 'username',
field: 'username',
organize: by_character
}),
normalized_username: new FSDB_INDEXER_SYMLINKS<USER>({
name: 'normalized_username',
get_values_to_index: (user) => {
return [user.username.toLowerCase()];
},
organize: by_character
})
}
});

View file

@ -0,0 +1,15 @@
import { FSDB_COLLECTION } from 'jsr:@andyburke/fsdb';
export type USER_PERMISSIONS = {
user_id: string;
permissions: string[];
timestamps: {
created: string;
updated: string;
};
};
export const USER_PERMISSIONS_STORE = new FSDB_COLLECTION<USER_PERMISSIONS>({
name: 'user_permissions',
id_field: 'user_id'
});