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

DB => Add creation date info for assignments and exercises

parent a48d6276
No related branches found
No related tags found
No related merge requests found
Pipeline #38011 failed
/*
Warnings:
- Added the required column `gitlabCreationDate` to the `Assignment` table without a default value. This is not possible if the table is not empty.
- Added the required column `gitlabCreationDate` to the `Exercise` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Assignment` ADD COLUMN `gitlabCreationDate` DATETIME(3) NULL AFTER `gitlabCreationInfo`;
UPDATE `Assignment` SET `gitlabCreationDate` = `gitlabLastInfoDate`;
ALTER TABLE `Assignment` MODIFY COLUMN `gitlabCreationDate` DATETIME(3) NOT NULL AFTER `gitlabCreationInfo`;
-- AlterTable
ALTER TABLE `Exercise` ADD COLUMN `gitlabCreationDate` DATETIME(3) NULL DEFAULT NULL AFTER `gitlabCreationInfo`;
UPDATE `Exercise` SET `gitlabCreationDate` = `gitlabLastInfoDate`;
ALTER TABLE `Exercise` MODIFY COLUMN `gitlabCreationDate` DATETIME(3) NOT NULL AFTER `gitlabCreationInfo`;
......@@ -38,6 +38,7 @@ model Assignment {
gitlabId Int
gitlabLink String
gitlabCreationInfo Json @db.Json
gitlabCreationDate DateTime
gitlabLastInfo Json @db.Json
gitlabLastInfoDate DateTime
published Boolean @default(false)
......@@ -55,6 +56,7 @@ model Exercise {
gitlabId Int
gitlabLink String
gitlabCreationInfo Json @db.Json
gitlabCreationDate DateTime
gitlabLastInfo Json @db.Json
gitlabLastInfoDate DateTime
deleted Boolean @default(false)
......
......@@ -3,11 +3,10 @@ import '../src/init.js';
import * as process from 'process';
import SharedConfig from '../src/shared/config/SharedConfig.js';
import { UserRole } from '@prisma/client';
import { TagType, UserRole } from '@prisma/client';
import logger from '../src/shared/logging/WinstonLogger.js';
import db from '../src/helpers/DatabaseHelper.js';
import TagManager from '../src/managers/TagManager';
import { TagType } from '@prisma/client';
async function main() {
await users();
......@@ -218,6 +217,7 @@ async function assignments() {
'issue_branch_template' : null,
'autoclose_referenced_issues' : true
},
gitlabCreationDate: new Date('2021-10-14T14:20:15.239Z'),
gitlabLastInfo : {
'id' : 13862,
'description' : 'Dojo assignment repository.\n\nName of the assignment: c_hello_world',
......@@ -473,6 +473,7 @@ async function assignments() {
'issue_branch_template' : null,
'autoclose_referenced_issues' : true
},
gitlabCreationDate: new Date('2023-11-07T20:35:54.692Z'),
gitlabLastInfo : {
'id' : 13893,
'description' : 'Dojo assignment repository.\n\nName of the assignment: Technique de compilation - TP',
......@@ -766,6 +767,7 @@ async function exercises() {
'issue_branch_template' : null,
'autoclose_referenced_issues' : true
},
gitlabCreationDate: new Date('2023-12-14T14:54:35.692Z'),
gitlabLastInfo : {
'id' : 14232,
'description' : 'Dojo exercise repository based on the the assignment: Technique de compilation - TP',
......@@ -1598,7 +1600,7 @@ async function tag() {
update: {},
create: {
name: 'Java',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1606,7 +1608,7 @@ async function tag() {
update: {},
create: {
name: 'Scala',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1614,7 +1616,7 @@ async function tag() {
update: {},
create: {
name: 'Kotlin',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1622,7 +1624,7 @@ async function tag() {
update: {},
create: {
name: 'Rust',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1630,7 +1632,7 @@ async function tag() {
update: {},
create: {
name: 'JavaScript',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1638,7 +1640,7 @@ async function tag() {
update: {},
create: {
name: 'TypeScript',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1646,7 +1648,7 @@ async function tag() {
update: {},
create: {
name: 'Python',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1654,7 +1656,7 @@ async function tag() {
update: {},
create: {
name: 'HTML',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1662,7 +1664,7 @@ async function tag() {
update: {},
create: {
name: 'CSS',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1670,7 +1672,7 @@ async function tag() {
update: {},
create: {
name: 'C++',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1678,7 +1680,7 @@ async function tag() {
update: {},
create: {
name: 'Go',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1686,7 +1688,7 @@ async function tag() {
update: {},
create: {
name: 'PHP',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1694,7 +1696,7 @@ async function tag() {
update: {},
create: {
name: 'C#',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1702,7 +1704,7 @@ async function tag() {
update: {},
create: {
name: 'Swift',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1710,7 +1712,7 @@ async function tag() {
update: {},
create: {
name: 'Matlab',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1718,7 +1720,7 @@ async function tag() {
update: {},
create: {
name: 'SQL',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1726,7 +1728,7 @@ async function tag() {
update: {},
create: {
name: 'Assembly',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1734,7 +1736,7 @@ async function tag() {
update: {},
create: {
name: 'Ruby',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1742,7 +1744,7 @@ async function tag() {
update: {},
create: {
name: 'Fortran',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1750,7 +1752,7 @@ async function tag() {
update: {},
create: {
name: 'Pascal',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1758,7 +1760,7 @@ async function tag() {
update: {},
create: {
name: 'Visual Basic',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1766,7 +1768,7 @@ async function tag() {
update: {},
create: {
name: 'R',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1774,7 +1776,7 @@ async function tag() {
update: {},
create: {
name: 'Objective-C',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1782,7 +1784,7 @@ async function tag() {
update: {},
create: {
name: 'Lua',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1790,7 +1792,7 @@ async function tag() {
update: {},
create: {
name: 'Ada',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1798,7 +1800,7 @@ async function tag() {
update: {},
create: {
name: 'Haskell',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......@@ -1806,7 +1808,7 @@ async function tag() {
update: {},
create: {
name: 'Shell/PowerShell',
type : TagType.LANGUAGE,
type: TagType.LANGUAGE
}
});
await db.tag.upsert({
......
......@@ -175,6 +175,7 @@ class AssignmentRoutes implements RoutesManager {
gitlabId : repository.id,
gitlabLink : repository.web_url,
gitlabCreationInfo: repository as unknown as Prisma.JsonObject,
gitlabCreationDate: new Date(),
gitlabLastInfo : repository as unknown as Prisma.JsonObject,
gitlabLastInfoDate: new Date(),
staff : {
......
......@@ -234,6 +234,7 @@ class ExerciseRoutes implements RoutesManager {
gitlabId : repository.id,
gitlabLink : repository.web_url,
gitlabCreationInfo: repository as unknown as Prisma.JsonObject,
gitlabCreationDate: new Date(),
gitlabLastInfo : repository as unknown as Prisma.JsonObject,
gitlabLastInfoDate: new Date(),
members : {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment