Implement requests page

This commit is contained in:
Jorge Vargas 2025-06-19 19:42:24 -06:00
parent 75eaf17346
commit d3439321ba
14 changed files with 10333 additions and 7522 deletions

View file

@ -5,7 +5,7 @@ const LIMIT_PENDING = 5
export default async function MigrationFn(tx: Prisma.TransactionClient) {
const donatorRequests = await tx.requests.findMany({
where: { donator: true, state: RequestState.PENDING, userID: { not: null } }
where: { donator: true, state: RequestState.PENDING }
})
const donatorMap = new Map<string, typeof donatorRequests>()

View file

@ -0,0 +1,19 @@
/*
Warnings:
- You are about to drop the column `user` on the `requests` table. All the data in the column will be lost.
- You are about to drop the column `createdAt` on the `roles` table. All the data in the column will be lost.
- You are about to drop the column `updatedAt` on the `roles` table. All the data in the column will be lost.
- Made the column `userID` on table `requests` required. This step will fail if there are existing NULL values in that column.
*/
DELETE FROM `requests` WHERE `userId` IS NULL;
-- AlterTable
ALTER TABLE `requests` DROP COLUMN `user`,
MODIFY `userID` VARCHAR(255) NOT NULL;
-- AlterTable
ALTER TABLE `roles` DROP COLUMN `createdAt`,
DROP COLUMN `updatedAt`;

View file

@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "mysql"
provider = "mysql"

View file

@ -344,8 +344,7 @@ model requests {
id Int @id @default(autoincrement())
title String? @db.VarChar(255)
link String? @db.VarChar(255)
user String? @db.VarChar(255)
userID String? @db.VarChar(255)
userID String @db.VarChar(255)
state RequestState
donator Boolean
reason String? @db.VarChar(255)
@ -359,8 +358,6 @@ model requests {
model roles {
name String @id @db.VarChar(255)
permissions Json?
createdAt DateTime @db.DateTime(0)
updatedAt DateTime @db.DateTime(0)
users User_Role[]
}