浏览代码

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

tags/0.0.1^2
J 3 年前
父节点
当前提交
f4d8d04a22

+ 1
- 1
frontend/src/entities/card/index.js 查看文件

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

+ 2
- 2
frontend/src/entities/grouping/grouping.js 查看文件

1
 /** @module entities/grouping */
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
 /** Class representing a grouping */
6
 /** Class representing a grouping */
7
 class Grouping extends _baseRecord {
7
 class Grouping extends _baseRecord {

+ 2
- 2
frontend/src/entities/grouping/index.js 查看文件

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
-export * from './_modules'
1
+export * from './_modules.js'
2
 
2
 
3
 /** Your different entities */
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
-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
 /** @module entities/profile */
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
 /** Class representing a profile */
5
 /** Class representing a profile */
6
 class Profile extends _baseRecord {
6
 class Profile extends _baseRecord {
14
     constructor({ email, ...profileData }) {
14
     constructor({ email, ...profileData }) {
15
         super()
15
         super()
16
 
16
 
17
-        this.type = this.constructor.name.toLowerCase() 
17
+        this.type = this.constructor.name.toLowerCase()
18
 
18
 
19
         /**  Fields */
19
         /**  Fields */
20
         this.email = email // ! required
20
         this.email = email // ! required

+ 1
- 1
frontend/src/entities/profile/profile.schema.js 查看文件

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

+ 8
- 1
frontend/src/entities/profile/profile.spec.js 查看文件

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
-export * from './response.schema'
1
+export * from './response.schema.js'

+ 2
- 2
frontend/src/entities/survey/index.js 查看文件

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
 /** @module survey/survey */
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
 class Survey extends _baseRecord {
5
 class Survey extends _baseRecord {
6
     constructor(questionSteps, roles) {
6
     constructor(questionSteps, roles) {
9
         this.type = this.constructor.name.toLowerCase()
9
         this.type = this.constructor.name.toLowerCase()
10
 
10
 
11
         /**  Fields */
11
         /**  Fields */
12
-        this.steps = [
13
-            ...questionSteps
14
-        ] // ! required
12
+        this.steps = [...questionSteps] // ! required
15
         this.roleTree = roles
13
         this.roleTree = roles
16
 
14
 
17
         return this
15
         return this
18
     }
16
     }
19
     setRoleResponses(position) {
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
         roleStep.responses = this.roleTree[position]
21
         roleStep.responses = this.roleTree[position]
22
     }
22
     }
23
     isValid() {
23
     isValid() {
33
         /** validate(this) always returns something so force it to a bool */
33
         /** validate(this) always returns something so force it to a bool */
34
         return !validate.error ? true : false
34
         return !validate.error ? true : false
35
     }
35
     }
36
-
37
 }
36
 }
38
 
37
 
39
 export { Survey }
38
 export { Survey }

+ 12
- 10
frontend/src/entities/survey/survey.schema.js 查看文件

1
 import Joi from 'joi'
1
 import Joi from 'joi'
2
-import { allModules } from '..'
2
+import { allModules } from '../index.js'
3
 
3
 
4
 /**
4
 /**
5
  * membership schema object
5
  * membership schema object
17
         type: Joi.string(),
17
         type: Joi.string(),
18
 
18
 
19
         /** Survey fields */
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
     /** fields required before saving */
32
     /** fields required before saving */
31
     required: ['steps'],
33
     required: ['steps'],

正在加载...
取消
保存