From 3cd4b0c0e18fb8e8f52062cf4b171c8c67d4baea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Fri, 28 Jul 2023 17:06:32 +0200
Subject: [PATCH] Transfert shared models and types in this repo

---
 models/Enonce.ts   | 20 ++++++++++++++++++++
 models/Exercice.ts | 16 ++++++++++++++++
 models/User.ts     | 13 +++++++++++++
 types/ApiRoutes.ts | 13 +++++++++++++
 4 files changed, 62 insertions(+)
 create mode 100644 models/Enonce.ts
 create mode 100644 models/Exercice.ts
 create mode 100644 models/User.ts
 create mode 100644 types/ApiRoutes.ts

diff --git a/models/Enonce.ts b/models/Enonce.ts
new file mode 100644
index 0000000..a8756c4
--- /dev/null
+++ b/models/Enonce.ts
@@ -0,0 +1,20 @@
+import GitlabRepository from '../../shared/types/Gitlab/GitlabRepository';
+import User             from './User';
+import Exercice         from './Exercice';
+
+
+interface Enonce {
+    name: string;
+    gitlabId: number;
+    gitlabLink: string;
+    gitlabCreationInfo: GitlabRepository;
+    gitlabLastInfo: GitlabRepository;
+    gitlabLastInfoDate: string;
+    published: boolean;
+
+    staff: Array<User>;
+    exercices: Array<Exercice>;
+}
+
+
+export default Enonce;
\ No newline at end of file
diff --git a/models/Exercice.ts b/models/Exercice.ts
new file mode 100644
index 0000000..7198b86
--- /dev/null
+++ b/models/Exercice.ts
@@ -0,0 +1,16 @@
+import GitlabRepository from '../../shared/types/Gitlab/GitlabRepository';
+
+
+interface Exercice {
+    id: string;
+    enonceName: string;
+    name: string;
+    gitlabId: number;
+    gitlabLink: string;
+    gitlabCreationInfo: GitlabRepository;
+    gitlabLastInfo: GitlabRepository;
+    gitlabLastInfoDate: string;
+}
+
+
+export default Exercice;
\ No newline at end of file
diff --git a/models/User.ts b/models/User.ts
new file mode 100644
index 0000000..a2f3e16
--- /dev/null
+++ b/models/User.ts
@@ -0,0 +1,13 @@
+interface User {
+    id: number;
+    firstName: string;
+    lastName: string;
+    mail: string;
+    gitlabId: number;
+    role: string;
+    isTeachingStaff: boolean;
+    deleted: boolean;
+}
+
+
+export default User;
diff --git a/types/ApiRoutes.ts b/types/ApiRoutes.ts
new file mode 100644
index 0000000..04c0ae6
--- /dev/null
+++ b/types/ApiRoutes.ts
@@ -0,0 +1,13 @@
+enum ApiRoutes {
+    LOGIN                        = '/login',
+    TEST_SESSION                 = '/test_session',
+    GITLAB_CHECK_TEMPLATE_ACCESS = '/gitlab/project/{{id}}/checkTemplateAccess',
+    ENONCE_GET                   = '/enonces/{{nameOrUrl}}',
+    ENONCE_CREATE                = '/enonces',
+    ENONCE_PUBLISH               = '/enonces/{{nameOrUrl}}/publish',
+    ENONCE_UNPUBLISH             = '/enonces/{{nameOrUrl}}/unpublish',
+    EXERCICE_CREATE              = '/enonces/{{nameOrUrl}}/exercices',
+}
+
+
+export default ApiRoutes;
\ No newline at end of file
-- 
GitLab