Merge branch 'dev' into boards
# Conflicts: # pnpm-lock.yaml
This commit is contained in:
commit
5ce1b40330
93 files changed
+3153
-1340
No files matched your search
@@ -7,7 +7,7 @@ import { checkPassword } from '@/lib/password';
|
||||
import redis from '@/lib/redis';
|
||||
import { parseRequest } from '@/lib/request';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { getUserByUsername } from '@/queries/prisma';
|
||||
import { getAllUserTeams, getUserByUsername } from '@/queries/prisma';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const schema = z.object({
|
||||
@@ -39,8 +39,10 @@ export async function POST(request: Request) {
|
||||
token = createSecureToken({ userId: user.id, role }, secret());
|
||||
}
|
||||
|
||||
const teams = await getAllUserTeams(id);
|
||||
|
||||
return json({
|
||||
token,
|
||||
user: { id, username, role, createdAt, isAdmin: role === ROLES.admin },
|
||||
user: { id, username, role, createdAt, isAdmin: role === ROLES.admin, teams },
|
||||
});
|
||||
}
|
||||
@@ -17,6 +17,7 @@ export async function POST(request: Request) {
|
||||
const errors = [];
|
||||
|
||||
let index = 0;
|
||||
let cache = null;
|
||||
for (const data of body) {
|
||||
// Recreate a fresh Request since `new Request(request)` will have the following error:
|
||||
// > Cannot read private member #state from an object whose class did not declare it
|
||||
@@ -33,9 +34,12 @@ export async function POST(request: Request) {
|
||||
});
|
||||
|
||||
const response = await send.POST(newRequest);
|
||||
const responseJson = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
errors.push({ index, response: await response.json() });
|
||||
errors.push({ index, response: responseJson });
|
||||
} else {
|
||||
cache ??= responseJson.cache;
|
||||
}
|
||||
|
||||
index++;
|
||||
@@ -46,6 +50,7 @@ export async function POST(request: Request) {
|
||||
processed: body.length - errors.length,
|
||||
errors: errors.length,
|
||||
details: errors,
|
||||
cache,
|
||||
});
|
||||
} catch (e) {
|
||||
return serverError(e);
|
||||
|
||||
@@ -41,6 +41,9 @@ const schema = z.object({
|
||||
userAgent: z.string().optional(),
|
||||
timestamp: z.coerce.number().int().optional(),
|
||||
id: z.string().optional(),
|
||||
browser: z.string().optional(),
|
||||
os: z.string().optional(),
|
||||
device: z.string().optional(),
|
||||
})
|
||||
.refine(
|
||||
data => {
|
||||
|
||||
Reference in new issue
Block a user