Skip to content

Commit

Permalink
upgrade to prisma 6 (#2486)
Browse files Browse the repository at this point in the history
  • Loading branch information
dqnykamp authored Dec 9, 2024
1 parent 506ca03 commit faea621
Show file tree
Hide file tree
Showing 9 changed files with 395 additions and 334 deletions.
82 changes: 46 additions & 36 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"@aws-sdk/client-ses": "^3.629.0",
"@prisma/client": "^5.18.0",
"@prisma/client": "^6.0.1",
"@quixo3/prisma-session-store": "^3.1.13",
"cookie-parser": "^1.4.6",
"dotenv": "^16.4.5",
Expand Down Expand Up @@ -46,7 +46,7 @@
"globals": "^15.9.0",
"nodemon": "^3.1.4",
"prettier": "^3.3.3",
"prisma": "^5.18.0",
"prisma": "^6.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.5.4",
"typescript-eslint": "^8.1.0",
Expand Down
3 changes: 1 addition & 2 deletions server/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextIndex"]
provider = "prisma-client-js"
}

datasource db {
Expand Down
31 changes: 16 additions & 15 deletions server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ import {
assignmentStudentDataConvertUUID,
allAssignmentScoresConvertUUID,
studentDataConvertUUID,
isEqualUUID,
} from "./utils/uuid";
import { LicenseCode, UserInfo } from "./types";

Expand Down Expand Up @@ -1058,7 +1059,7 @@ app.get(
);

app.get("/api/searchSharedContent", async (req: Request, res: Response) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const query = req.query.q as string;
res.send({
users: (await searchUsersWithSharedContent(query, loggedInUserId)).map(
Expand Down Expand Up @@ -1105,7 +1106,7 @@ app.post(
app.get(
"/api/loadPromotedContent",
async (req: Request, res: Response, next: NextFunction) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);

try {
const content = await loadPromotedContent(loggedInUserId);
Expand Down Expand Up @@ -1304,7 +1305,7 @@ app.post(
app.get(
"/api/getActivityEditorData/:activityId",
async (req: Request, res: Response, next: NextFunction) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const activityId = toUUID(req.params.activityId);
try {
const editorData = await getActivityEditorData(
Expand All @@ -1331,7 +1332,7 @@ app.get(
app.get(
"/api/getSharedEditorData/:activityId",
async (req: Request, res: Response, next: NextFunction) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const activityId = toUUID(req.params.activityId);
try {
const editorData = await getSharedEditorData(activityId, loggedInUserId);
Expand All @@ -1352,7 +1353,7 @@ app.get(
app.get(
"/api/getDocumentSource/:docId",
async (req: Request, res: Response, next: NextFunction) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const docId = toUUID(req.params.docId);
try {
const sourceData = await getDocumentSource(docId, loggedInUserId);
Expand Down Expand Up @@ -1383,7 +1384,7 @@ app.get("/api/getAllLicenses", async (_req: Request, res: Response) => {
app.get(
"/api/getActivityViewerData/:activityId",
async (req: Request, res: Response, next: NextFunction) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const activityId = toUUID(req.params.activityId);

try {
Expand All @@ -1409,7 +1410,7 @@ app.get(
app.get(
"/api/getContributorHistory/:activityId",
async (req: Request, res: Response, next: NextFunction) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const activityId = toUUID(req.params.activityId);

try {
Expand All @@ -1435,7 +1436,7 @@ app.get(
app.get(
"/api/getRemixes/:activityId",
async (req: Request, res: Response, next: NextFunction) => {
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const activityId = toUUID(req.params.activityId);

try {
Expand Down Expand Up @@ -2166,7 +2167,7 @@ app.get(
const ownerId = toUUID(req.params.ownerId);
const loggedInUserId = req.user?.userId;

if (!loggedInUserId || !ownerId.equals(loggedInUserId)) {
if (!loggedInUserId || !isEqualUUID(ownerId, loggedInUserId)) {
return res.send({ notMe: true });
}

Expand Down Expand Up @@ -2203,7 +2204,7 @@ app.get(
const folderId = toUUID(req.params.folderId);
const loggedInUserId = req.user?.userId;

if (!loggedInUserId || !ownerId.equals(loggedInUserId)) {
if (!loggedInUserId || !isEqualUUID(ownerId, loggedInUserId)) {
return res.send({ notMe: true });
}

Expand Down Expand Up @@ -2243,7 +2244,7 @@ app.get(
const ownerId = toUUID(req.params.ownerId);
const query = req.query.q as string;

if (!loggedInUserId || !ownerId.equals(loggedInUserId)) {
if (!loggedInUserId || !isEqualUUID(ownerId, loggedInUserId)) {
return res.send({ notMe: true });
}

Expand Down Expand Up @@ -2289,7 +2290,7 @@ app.get(
const folderId = toUUID(req.params.folderId);
const query = req.query.q as string;

if (!loggedInUserId || !ownerId.equals(loggedInUserId)) {
if (!loggedInUserId || !isEqualUUID(ownerId, loggedInUserId)) {
return res.send({ notMe: true });
}

Expand Down Expand Up @@ -2323,7 +2324,7 @@ app.get(
"/api/getSharedFolderContent/:ownerId",
async (req: Request, res: Response, next: NextFunction) => {
const ownerId = toUUID(req.params.ownerId);
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
try {
const contentData = await getSharedFolderContent({
ownerId,
Expand Down Expand Up @@ -2352,7 +2353,7 @@ app.get(
async (req: Request, res: Response, next: NextFunction) => {
const ownerId = toUUID(req.params.ownerId);
const folderId = toUUID(req.params.folderId);
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
try {
const contentData = await getSharedFolderContent({
ownerId,
Expand Down Expand Up @@ -2444,7 +2445,7 @@ app.get(
async (req: Request, res: Response, next: NextFunction) => {
try {
const activityId = toUUID(req.body.activityId);
const loggedInUserId = req.user?.userId ?? Buffer.alloc(16);
const loggedInUserId = req.user?.userId ?? new Uint8Array(16);
const classifications = await getClassifications(
activityId,
loggedInUserId,
Expand Down
Loading

0 comments on commit faea621

Please sign in to comment.