Add partial report information to d1
This commit is contained in:
@ -148,7 +148,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
|
||||
await context.env.DATA.put(
|
||||
`reportprocessing_${reportId}`,
|
||||
context.data.current_user.id,
|
||||
currentUser?.id || context.request.headers.get("CF-Connecting-IP"),
|
||||
{ expirationTtl: 3600 }
|
||||
);
|
||||
|
||||
@ -164,17 +164,27 @@ export async function onRequestPost(context: RequestContext) {
|
||||
["mkv", "mov", "wmv"].includes(fileExt.toLowerCase()) ? "mp4" : fileExt
|
||||
}`,
|
||||
id: reportId,
|
||||
user: {
|
||||
discriminator: currentUser.discriminator,
|
||||
email: currentUser.email,
|
||||
id: currentUser.id,
|
||||
username: currentUser.username,
|
||||
},
|
||||
user: currentUser
|
||||
? {
|
||||
discriminator: currentUser.discriminator,
|
||||
email: currentUser.email,
|
||||
id: currentUser.id,
|
||||
username: currentUser.username,
|
||||
}
|
||||
: null,
|
||||
target_ids: metaIDs,
|
||||
target_usernames: metaNames,
|
||||
})
|
||||
);
|
||||
|
||||
try {
|
||||
await context.env.D1.prepare(
|
||||
"INSERT INTO reports (created_at, id, open, user) VALUES (?, ?, ?, ?);"
|
||||
)
|
||||
.bind(Date.now(), reportId, 1, currentUser?.id || null)
|
||||
.run();
|
||||
} catch {}
|
||||
|
||||
return new Response(JSON.stringify({ id: reportId, upload_url: uploadUrl }), {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
|
Reference in New Issue
Block a user