Skip to content
Snippets Groups Projects
Commit 2e5cd782 authored by michael.minelli's avatar michael.minelli
Browse files

Tags => Code integration

parent b6fb2df8
Branches
Tags
No related merge requests found
Pipeline #33333 passed
Showing
with 73 additions and 61 deletions
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
<component name="MaterialThemeProjectNewConfig"> <component name="MaterialThemeProjectNewConfig">
<option name="metadata"> <option name="metadata">
<MTProjectMetadataState> <MTProjectMetadataState>
<option name="userId" value="104e8585:19002424fea:-7fcc" /> <option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="104e8585:19002424fea:-7ffe" />
</MTProjectMetadataState> </MTProjectMetadataState>
</option> </option>
</component> </component>
......
openapi: 3.1.0 openapi: 3.1.0
info: info:
title: Dojo API title: Dojo API
version: 4.1.0 version: 4.2.0
description: | description: |
**Backend API of the Dojo project.** **Backend API of the Dojo project.**
......
-- CreateTable
CREATE TABLE `Tag` (
`name` CHAR(36) NOT NULL,
`type` ENUM('LANGUAGE', 'FRAMEWORK', 'THEME', 'USERDEFINED') NOT NULL,
PRIMARY KEY (`name`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable -- CreateTable
CREATE TABLE `_AssignmentToTag` ( CREATE TABLE `_AssignmentToTag` (
`A` VARCHAR(191) NOT NULL, `A` VARCHAR(191) NOT NULL,
...@@ -27,3 +35,12 @@ ALTER TABLE `_ExerciseToTag` ADD CONSTRAINT `_ExerciseToTag_A_fkey` FOREIGN KEY ...@@ -27,3 +35,12 @@ ALTER TABLE `_ExerciseToTag` ADD CONSTRAINT `_ExerciseToTag_A_fkey` FOREIGN KEY
-- AddForeignKey -- AddForeignKey
ALTER TABLE `_ExerciseToTag` ADD CONSTRAINT `_ExerciseToTag_B_fkey` FOREIGN KEY (`B`) REFERENCES `Tag`(`name`) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE `_ExerciseToTag` ADD CONSTRAINT `_ExerciseToTag_B_fkey` FOREIGN KEY (`B`) REFERENCES `Tag`(`name`) ON DELETE CASCADE ON UPDATE CASCADE;
-- CreateTable
CREATE TABLE `SubmissionTag` (
`name` CHAR(36) NOT NULL,
`type` ENUM('LANGUAGE', 'FRAMEWORK', 'THEME', 'USERDEFINED') NOT NULL,
`state` VARCHAR(191) NOT NULL,
PRIMARY KEY (`name`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- This is an empty migration.
\ No newline at end of file
-- This is an empty migration.
\ No newline at end of file
-- This is an empty migration.
\ No newline at end of file
-- CreateTable
CREATE TABLE `SubmissionTag` (
`name` CHAR(36) NOT NULL,
`type` ENUM('LANGUAGE', 'FRAMEWORK', 'THEME', 'USERDEFINED') NOT NULL,
PRIMARY KEY (`name`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- This is an empty migration.
\ No newline at end of file
-- This is an empty migration.
\ No newline at end of file
-- This is an empty migration.
\ No newline at end of file
/*
Warnings:
- Added the required column `state` to the `SubmissionTag` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `SubmissionTag` ADD COLUMN `state` ENUM('PENDINGAPPROVAL', 'DECLINED', 'APPROVED') NOT NULL;
/*
Warnings:
- You are about to alter the column `state` on the `SubmissionTag` table. The data in that column could be lost. The data in that column will be cast from `Enum(EnumId(3))` to `VarChar(191)`.
*/
-- AlterTable
ALTER TABLE `SubmissionTag` MODIFY `state` VARCHAR(191) NOT NULL;
/*
Warnings:
- You are about to alter the column `state` on the `SubmissionTag` table. The data in that column could be lost. The data in that column will be cast from `VarChar(191)` to `Enum(EnumId(3))`.
*/
-- AlterTable
ALTER TABLE `SubmissionTag` MODIFY `state` ENUM('PENDINGAPPROVAL', 'DECLINED', 'APPROVED') NOT NULL;
-- This is an empty migration.
\ No newline at end of file
/*
Warnings:
- You are about to alter the column `state` on the `SubmissionTag` table. The data in that column could be lost. The data in that column will be cast from `Enum(EnumId(3))` to `VarChar(191)`.
*/
-- AlterTable
ALTER TABLE `SubmissionTag` MODIFY `state` VARCHAR(191) NOT NULL;
/*
Warnings:
- You are about to drop the `SubmissionTag` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
DROP TABLE `SubmissionTag`;
-- CreateTable -- CreateTable
CREATE TABLE `Tag` ( CREATE TABLE `TagProposal` (
`name` CHAR(36) NOT NULL, `name` CHAR(36) NOT NULL,
`type` ENUM('LANGUAGE', 'FRAMEWORK', 'THEME', 'USERDEFINED') NOT NULL, `type` ENUM('LANGUAGE', 'FRAMEWORK', 'THEME', 'USERDEFINED') NOT NULL,
`state` VARCHAR(191) NOT NULL,
PRIMARY KEY (`name`) PRIMARY KEY (`name`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AlterTable
ALTER TABLE `TagProposal` MODIFY `state` VARCHAR(191) NOT NULL DEFAULT 'PendingApproval';
-- AlterTable
ALTER TABLE `TagProposal` ADD COLUMN `details` VARCHAR(191) NULL;
...@@ -15,9 +15,9 @@ enum UserRole { ...@@ -15,9 +15,9 @@ enum UserRole {
enum TagType { enum TagType {
LANGUAGE LANGUAGE
FRAMEWORK FRAMEWORK
THEME THEME
USERDEFINED USERDEFINED
} }
model User { model User {
...@@ -44,7 +44,7 @@ model Assignment { ...@@ -44,7 +44,7 @@ model Assignment {
exercises Exercise[] exercises Exercise[]
staff User[] staff User[]
tags Tag[] tags Tag[]
} }
model Exercise { model Exercise {
...@@ -83,15 +83,16 @@ model Result { ...@@ -83,15 +83,16 @@ model Result {
} }
model Tag { model Tag {
name String @id @db.Char(36) name String @id @db.Char(36)
type TagType type TagType
assignment Assignment[] assignments Assignment[]
exercise Exercise[] exercises Exercise[]
  • michael.minelli @michael.minelli ·
    Author Owner

    @vincent.steinman

    1. La encore en regardant ce qui se fait ailleurs dans le fichier. Les tableaux qui jouent le rôle de jointure sont nommé au pluriel.
    2. Je ne l'ai pas encore retiré car je peux me tromper, mais je ne vois pas pourquoi vous avez mis des tags sur les exercices ? Qui les définirai et pourquoi pas seulement prendre ceux de l'assignment correspondant ? @orestis.malaspin
  • Please register or sign in to reply
} }
model SubmissionTag { model TagProposal {
name String @id @db.Char(36) name String @id @db.Char(36)
type TagType type TagType
state String state String @default("PendingApproval")
} details String?
\ No newline at end of file }
import { TagProposal } from '@prisma/client';
import db from '../helpers/DatabaseHelper';
class TagProposalManager {
async get(name: string | undefined = undefined): Promise<TagProposal | undefined> {
return await db.tagProposal.findUnique({
where: {
name: name
}
}) as unknown as TagProposal ?? undefined;
}
}
export default new TagProposalManager();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment