Add new tests to server routes

This commit is contained in:
Jesse Wierzbinski 2024-04-11 03:52:44 -10:00
parent 6263c667e8
commit 6b3c604c33
No known key found for this signature in database
7 changed files with 524 additions and 17 deletions

View file

@ -1,6 +1,11 @@
import type { InferSelectModel } from "drizzle-orm";
import type { token } from "~drizzle/schema";
/**
* The type of token.
*/
export enum TokenType {
BEARER = "Bearer",
}
export type Token = InferSelectModel<typeof token>;

View file

@ -563,6 +563,7 @@ export const createNewLocalUser = async (data: {
avatar?: string;
header?: string;
admin?: boolean;
skipPasswordHash?: boolean;
}): Promise<UserWithRelations | null> => {
const keys = await generateUserKeys();
@ -572,7 +573,9 @@ export const createNewLocalUser = async (data: {
.values({
username: data.username,
displayName: data.display_name ?? data.username,
password: await Bun.password.hash(data.password),
password: data.skipPasswordHash
? data.password
: await Bun.password.hash(data.password),
email: data.email,
note: data.bio ?? "",
avatar: data.avatar ?? config.defaults.avatar,