Просмотр исходного кода

:recycle: adding back file type for ava to find paths

tags/0.0.1^2
J 3 лет назад
Родитель
Сommit
f4d8d04a22

+ 1
- 1
frontend/src/entities/card/index.js Просмотреть файл

@@ -1 +1 @@
1
-export * from './card'
1
+export * from './card.js'

+ 2
- 2
frontend/src/entities/grouping/grouping.js Просмотреть файл

@@ -1,7 +1,7 @@
1 1
 /** @module entities/grouping */
2 2
 
3
-import { _baseRecord } from '..'
4
-import { groupingSchema } from './grouping.schema'
3
+import { _baseRecord } from '../index.js'
4
+import { groupingSchema } from './grouping.schema.js'
5 5
 
6 6
 /** Class representing a grouping */
7 7
 class Grouping extends _baseRecord {

+ 2
- 2
frontend/src/entities/grouping/index.js Просмотреть файл

@@ -1,2 +1,2 @@
1
-export * from './grouping'
2
-export * from './grouping.schema'
1
+export * from './grouping.js'
2
+export * from './grouping.schema.js'

+ 6
- 6
frontend/src/entities/index.js Просмотреть файл

@@ -1,8 +1,8 @@
1
-export * from './_modules'
1
+export * from './_modules.js'
2 2
 
3 3
 /** Your different entities */
4
-export * from './response'
5
-export * from './profile'
6
-export * from './survey'
7
-export * from './grouping'
8
-export * from './card'
4
+export * from './response/index.js'
5
+export * from './profile/index.js'
6
+export * from './survey/index.js'
7
+export * from './grouping/index.js'
8
+export * from './card/index.js'

+ 2
- 2
frontend/src/entities/profile/index.js Просмотреть файл

@@ -1,2 +1,2 @@
1
-export * from './profile'
2
-export * from './profile.schema'
1
+export * from './profile.js'
2
+export * from './profile.schema.js'

+ 3
- 3
frontend/src/entities/profile/profile.js Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 /** @module entities/profile */
2
-import { _baseRecord } from '..'
3
-import { profileSchema } from './profile.schema'
2
+import { _baseRecord } from '../index.js'
3
+import { profileSchema } from './profile.schema.js'
4 4
 
5 5
 /** Class representing a profile */
6 6
 class Profile extends _baseRecord {
@@ -14,7 +14,7 @@ class Profile extends _baseRecord {
14 14
     constructor({ email, ...profileData }) {
15 15
         super()
16 16
 
17
-        this.type = this.constructor.name.toLowerCase() 
17
+        this.type = this.constructor.name.toLowerCase()
18 18
 
19 19
         /**  Fields */
20 20
         this.email = email // ! required

+ 1
- 1
frontend/src/entities/profile/profile.schema.js Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 /** @module entities/profileSchema */
2 2
 import Joi from 'joi'
3
-import { allModules, responseSchema } from '..'
3
+import { allModules, responseSchema } from '../index.js'
4 4
 
5 5
 /**
6 6
  * profile schema object

+ 8
- 1
frontend/src/entities/profile/profile.spec.js Просмотреть файл

@@ -1 +1,8 @@
1
-// Write your profile test here
1
+import test from 'ava'
2
+import { Profile } from './profile.js'
3
+
4
+test('instantiate a Profile', async t => {
5
+    const profToTest = { email: 'fake@email.com', user_name: 'bob' }
6
+    const p = new Profile(profToTest)
7
+    t.is(p.user_name, profToTest.user_name)
8
+})

+ 1
- 1
frontend/src/entities/response/index.js Просмотреть файл

@@ -1 +1 @@
1
-export * from './response.schema'
1
+export * from './response.schema.js'

+ 2
- 2
frontend/src/entities/survey/index.js Просмотреть файл

@@ -1,2 +1,2 @@
1
-export * from './survey'
2
-export * from './survey.schema'
1
+export * from './survey.js'
2
+export * from './survey.schema.js'

+ 6
- 7
frontend/src/entities/survey/survey.js Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 /** @module survey/survey */
2
-import { _baseRecord } from '..'
3
-import { surveySchema } from './survey.schema'
2
+import { _baseRecord } from '../index.js'
3
+import { surveySchema } from './survey.schema.js'
4 4
 
5 5
 class Survey extends _baseRecord {
6 6
     constructor(questionSteps, roles) {
@@ -9,15 +9,15 @@ class Survey extends _baseRecord {
9 9
         this.type = this.constructor.name.toLowerCase()
10 10
 
11 11
         /**  Fields */
12
-        this.steps = [
13
-            ...questionSteps
14
-        ] // ! required
12
+        this.steps = [...questionSteps] // ! required
15 13
         this.roleTree = roles
16 14
 
17 15
         return this
18 16
     }
19 17
     setRoleResponses(position) {
20
-        const roleStep = this.steps.filter(step => step.response_key_prompt == 'role')[0]
18
+        const roleStep = this.steps.filter(
19
+            step => step.response_key_prompt == 'role',
20
+        )[0]
21 21
         roleStep.responses = this.roleTree[position]
22 22
     }
23 23
     isValid() {
@@ -33,7 +33,6 @@ class Survey extends _baseRecord {
33 33
         /** validate(this) always returns something so force it to a bool */
34 34
         return !validate.error ? true : false
35 35
     }
36
-
37 36
 }
38 37
 
39 38
 export { Survey }

+ 12
- 10
frontend/src/entities/survey/survey.schema.js Просмотреть файл

@@ -1,5 +1,5 @@
1 1
 import Joi from 'joi'
2
-import { allModules } from '..'
2
+import { allModules } from '../index.js'
3 3
 
4 4
 /**
5 5
  * membership schema object
@@ -17,15 +17,17 @@ const surveySchema = {
17 17
         type: Joi.string(),
18 18
 
19 19
         /** Survey fields */
20
-        steps: Joi.array().items(
21
-            Joi.object({
22
-                id: Joi.number(),
23
-                type: Joi.string(),
24
-                question: Joi.string(),
25
-                // TODO: specify responses to be array or null later
26
-                responses: Joi.any(),
27
-            })
28
-        ).required(),
20
+        steps: Joi.array()
21
+            .items(
22
+                Joi.object({
23
+                    id: Joi.number(),
24
+                    type: Joi.string(),
25
+                    question: Joi.string(),
26
+                    // TODO: specify responses to be array or null later
27
+                    responses: Joi.any(),
28
+                }),
29
+            )
30
+            .required(),
29 31
     }),
30 32
     /** fields required before saving */
31 33
     required: ['steps'],

Загрузка…
Отмена
Сохранить