sowell-models 1.32.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sowell-models",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "description": "SoWell models",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,13 +1,41 @@
1
1
  import { Attr, Model } from 'spraypaint'
2
2
  import { ApplicationRecord } from '../ApplicationRecord'
3
3
 
4
+ export interface IFormQuestionOption {
5
+ label: string
6
+ value: string
7
+ }
8
+
9
+ export interface IFormQuestion {
10
+ id: string
11
+ name: string
12
+ label?: string
13
+ export?: boolean
14
+ validation?: "required"
15
+ description?: string
16
+ // rating
17
+ max?: number
18
+ // selection
19
+ options?: IFormQuestionOption[]
20
+ // toggle
21
+ type?: "boolean"
22
+ // image / number-with-img / input-with-img / rating-with-img
23
+ imgs?: boolean | []
24
+ // sw-image
25
+ limit?: number
26
+ multiple?: boolean
27
+ }
28
+
4
29
  export interface IForm {
5
30
  id?: string
6
31
  name?: string
32
+ questions?: IFormQuestion[]
7
33
  }
8
34
 
35
+
9
36
  @Model()
10
37
  export class SPForm extends ApplicationRecord implements IForm {
11
38
  static jsonapiType = 'forms'
12
39
  @Attr() name!: string
40
+ @Attr() questions!: IFormQuestion[]
13
41
  }
@@ -2,6 +2,10 @@ import { Attr, BelongsTo, Model } from 'spraypaint'
2
2
  import { ApplicationRecord } from '../ApplicationRecord'
3
3
  import { IUser, SPUserItem } from '../User'
4
4
  import { IForm, SPForm } from '../Form'
5
+ import { SPResidenceItem } from '../Residence'
6
+ import { SPPlaceItem } from '../Place'
7
+ import { SPSpotItem } from '../Spot'
8
+ import { SPAgencyItem } from '../Agency'
5
9
 
6
10
  export interface IFormAnswerData {
7
11
  data: any[]
@@ -17,6 +21,10 @@ export interface IFormAnswer {
17
21
  answers?: IFormAnswerData
18
22
  author?: IUser
19
23
  form?: IForm
24
+ agency?: SPAgencyItem
25
+ residence?: SPResidenceItem
26
+ place?: SPPlaceItem
27
+ spot?: SPSpotItem
20
28
  }
21
29
 
22
30
  @Model()
@@ -26,4 +34,8 @@ export class SPFormAnswer extends ApplicationRecord implements IFormAnswer {
26
34
  @Attr() answers!: IFormAnswerData
27
35
  @BelongsTo() author!: SPUserItem
28
36
  @BelongsTo() form!: SPForm
37
+ @BelongsTo() agency!: SPAgencyItem
38
+ @BelongsTo() residence!: SPResidenceItem
39
+ @BelongsTo() place!: SPPlaceItem
40
+ @BelongsTo() spot!: SPSpotItem
29
41
  }