Skip to content

Commit

Permalink
enhance: use azure ad and @db.Text
Browse files Browse the repository at this point in the history
  • Loading branch information
rschlaefli committed Dec 7, 2022
1 parent c0dfe56 commit de0ed77
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
36 changes: 36 additions & 0 deletions prisma/migrations/20221207152228_text/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Warnings:
- You are about to alter the column `description` on the `Proposal` table. The data in that column could be lost. The data in that column will be cast from `NVarChar(1000)` to `Text`.
- You are about to alter the column `motivation` on the `ProposalApplication` table. The data in that column could be lost. The data in that column will be cast from `NVarChar(1000)` to `Text`.
- You are about to alter the column `comment` on the `UserProposalFeedback` table. The data in that column could be lost. The data in that column will be cast from `NVarChar(1000)` to `Text`.
*/
BEGIN TRY

BEGIN TRAN;

-- AlterTable
ALTER TABLE [dbo].[Account] ADD [ext_expires_in] INT;

-- AlterTable
ALTER TABLE [dbo].[Proposal] ALTER COLUMN [description] TEXT NOT NULL;

-- AlterTable
ALTER TABLE [dbo].[ProposalApplication] ALTER COLUMN [motivation] TEXT NOT NULL;

-- AlterTable
ALTER TABLE [dbo].[UserProposalFeedback] ALTER COLUMN [comment] TEXT NOT NULL;

COMMIT TRAN;

END TRY
BEGIN CATCH

IF @@TRANCOUNT > 0
BEGIN
ROLLBACK TRAN;
END;
THROW

END CATCH
7 changes: 4 additions & 3 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ model Account {
scope String?
id_token String? @db.Text
session_state String?
ext_expires_in Int?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
Expand Down Expand Up @@ -118,7 +119,7 @@ model Proposal {
id String @id @unique @default(uuid())
title String
description String
description String @db.Text
language String
studyLevel String
timeFrame String?
Expand Down Expand Up @@ -156,7 +157,7 @@ model ProposalApplication {
matriculationNumber String
fullName String
plannedStartAt DateTime
motivation String
motivation String @db.Text
attachments ApplicationAttachment[]
Expand Down Expand Up @@ -200,7 +201,7 @@ model UserProposalFeedback {
typeKey String
reason String
comment String
comment String @db.Text
@@unique([proposalId, userEmail])
}
12 changes: 6 additions & 6 deletions src/lib/authOptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PrismaAdapter } from '@next-auth/prisma-adapter'
import type { NextAuthOptions } from 'next-auth'
import { decode, encode } from 'next-auth/jwt'
// import AzureADProvider from 'next-auth/providers/azure-ad'
import AzureADProvider from 'next-auth/providers/azure-ad'
import EmailProvider from 'next-auth/providers/email'

import prisma from '../server/prisma'
Expand All @@ -20,11 +20,11 @@ export const authOptions: NextAuthOptions = {
},
from: process.env.EMAIL_FROM,
}),
// AzureADProvider({
// clientId: process.env.AZURE_AD_CLIENT_ID as string,
// clientSecret: process.env.AZURE_AD_CLIENT_SECRET as string,
// tenantId: process.env.AZURE_AD_TENANT_ID as string,
// }),
AzureADProvider({
clientId: process.env.AZURE_AD_CLIENT_ID as string,
clientSecret: process.env.AZURE_AD_CLIENT_SECRET as string,
tenantId: process.env.AZURE_AD_TENANT_ID as string,
}),
],
session: {
strategy: 'jwt',
Expand Down

0 comments on commit de0ed77

Please sign in to comment.