mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
Fix failing tests
This commit is contained in:
parent
6d2f9072ac
commit
c7743aa154
12 changed files with 245 additions and 200 deletions
|
|
@ -3,8 +3,11 @@ import { Token } from "~database/entities/Token";
|
|||
export const getUserByToken = async (access_token: string | null) => {
|
||||
if (!access_token) return null;
|
||||
|
||||
const token = await Token.findOneBy({
|
||||
access_token,
|
||||
const token = await Token.findOne({
|
||||
where: {
|
||||
access_token,
|
||||
},
|
||||
relations: ["user"],
|
||||
});
|
||||
|
||||
if (!token) return null;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
* @param request The request to parse
|
||||
*/
|
||||
export async function parseRequest<T>(request: Request): Promise<Partial<T>> {
|
||||
const formData = await request.formData();
|
||||
const query = new URL(request.url).searchParams;
|
||||
|
||||
// if request contains a JSON body
|
||||
|
|
@ -16,6 +15,8 @@ export async function parseRequest<T>(request: Request): Promise<Partial<T>> {
|
|||
|
||||
// If request contains FormData
|
||||
if (request.headers.get("Content-Type")?.includes("multipart/form-data")) {
|
||||
const formData = await request.formData();
|
||||
|
||||
if ([...formData.entries()].length > 0) {
|
||||
const data: Record<string, string | File> = {};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue