refactor: little light renaming
This commit is contained in:
parent
eef7b29223
commit
6f69695758
7 changed files with 31 additions and 31 deletions
|
@ -1,6 +1,6 @@
|
|||
import { PASSWORD_ENTRY, PASSWORD_ENTRY_STORE } from '../../../models/password_entry.ts';
|
||||
import { USER, USER_STORE } from '../../../models/user.ts';
|
||||
import { USER_PERMISSIONS, USER_PERMISSIONS_STORE } from '../../../models/user_permissions.ts';
|
||||
import { PASSWORD_ENTRIES, PASSWORD_ENTRY } from '../../../models/password_entry.ts';
|
||||
import { USER, USERS } from '../../../models/user.ts';
|
||||
import { PERMISSIONS_STORE, USER_PERMISSIONS } from '../../../models/user_permissions.ts';
|
||||
import { generateSecret } from 'jsr:@stdext/crypto/utils';
|
||||
import { hash } from 'jsr:@stdext/crypto/hash';
|
||||
import lurid from 'jsr:@andyburke/lurid';
|
||||
|
@ -45,7 +45,7 @@ export async function GET(_req: Request, meta: Record<string, any>): Promise<Res
|
|||
}
|
||||
|
||||
const limit = Math.min(parseInt(query.get('limit') ?? '10'), 100);
|
||||
const users = await USER_STORE.find({
|
||||
const users = await USERS.find({
|
||||
id: partial_id
|
||||
}, {
|
||||
limit
|
||||
|
@ -65,7 +65,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
const username: string = body.username?.trim() ?? '';
|
||||
const normalized_username = username.toLowerCase();
|
||||
|
||||
const existing_user_with_username = (await USER_STORE.find({
|
||||
const existing_user_with_username = (await USERS.find({
|
||||
normalized_username
|
||||
})).shift();
|
||||
if (existing_user_with_username) {
|
||||
|
@ -104,7 +104,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
}
|
||||
};
|
||||
|
||||
await USER_STORE.create(user);
|
||||
await USERS.create(user);
|
||||
|
||||
const salt = generateSecret();
|
||||
const hashed_password_value = hash('bcrypt', `${password_hash}${salt}`);
|
||||
|
@ -119,7 +119,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
}
|
||||
};
|
||||
|
||||
await PASSWORD_ENTRY_STORE.create(password_entry);
|
||||
await PASSWORD_ENTRIES.create(password_entry);
|
||||
|
||||
const user_permissions: USER_PERMISSIONS = {
|
||||
user_id: user.id,
|
||||
|
@ -130,7 +130,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
}
|
||||
};
|
||||
|
||||
await USER_PERMISSIONS_STORE.create(user_permissions);
|
||||
await PERMISSIONS_STORE.create(user_permissions);
|
||||
|
||||
const session_result: SESSION_RESULT = await get_session({
|
||||
user,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue