@prisma/client#pupil TypeScript Examples

The following examples show how to use @prisma/client#pupil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: token.ts    From backend with MIT License 6 votes vote down vote up
export async function refreshToken(pupil: pupil): Promise<string | never> {
    if (pupil.verification !== null) {
        throw new Error("Cannot request access token for Pupil in Verification process");
    }

    if (!pupil.active) {
        throw new Error("Access Token requested by deactivated user");
    }

    const secretToken = uuidv4();
    const hashedToken = hashToken(secretToken);

    await prisma.pupil.update({
        where: { id: pupil.id },
        data: {
            authToken: hashedToken,
            authTokenSent: new Date(),
            authTokenUsed: false
        }
    });

    logger.info(`Created new Auth Token for Pupil(${pupil.id}) with Hash: "${hashedToken}"`);

    return secretToken;
}
Example #2
Source File: DeActivateEvent.ts    From backend with MIT License 5 votes vote down vote up
constructor(user: Pupil | Student | pupil | student, newActiveStatus: boolean, deactivationReason?: string, deactivationFeedback?: string) {
        super(LogType.DEACTIVATE, user, {
            newStatus: newActiveStatus,
            deactivationReason,
            deactivationFeedback
        });
    }