sowell-models 1.30.0 → 1.32.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.30.0",
3
+ "version": "1.32.0",
4
4
  "description": "SoWell models",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/index.ts CHANGED
@@ -25,3 +25,5 @@ export * from './models/Location';
25
25
  export * from './models/Origin';
26
26
  export * from './models/Provider';
27
27
  export * from './models/UnseenIssue';
28
+ export * from './models/Form';
29
+ export * from './models/FormAnswer';
@@ -0,0 +1,13 @@
1
+ import { Attr, Model } from 'spraypaint'
2
+ import { ApplicationRecord } from '../ApplicationRecord'
3
+
4
+ export interface IForm {
5
+ id?: string
6
+ name?: string
7
+ }
8
+
9
+ @Model()
10
+ export class SPForm extends ApplicationRecord implements IForm {
11
+ static jsonapiType = 'forms'
12
+ @Attr() name!: string
13
+ }
@@ -0,0 +1,29 @@
1
+ import { Attr, BelongsTo, Model } from 'spraypaint'
2
+ import { ApplicationRecord } from '../ApplicationRecord'
3
+ import { IUser, SPUserItem } from '../User'
4
+ import { IForm, SPForm } from '../Form'
5
+
6
+ export interface IFormAnswerData {
7
+ data: any[]
8
+ agency?: string
9
+ residence?: string
10
+ place?: string
11
+ spot?: string
12
+ }
13
+
14
+ export interface IFormAnswer {
15
+ id?: string
16
+ createdAt?: string
17
+ answers?: IFormAnswerData
18
+ author?: IUser
19
+ form?: IForm
20
+ }
21
+
22
+ @Model()
23
+ export class SPFormAnswer extends ApplicationRecord implements IFormAnswer {
24
+ static jsonapiType = 'form_answers'
25
+ @Attr() createdAt!: string
26
+ @Attr() answers!: IFormAnswerData
27
+ @BelongsTo() author!: SPUserItem
28
+ @BelongsTo() form!: SPForm
29
+ }
@@ -1,4 +1,4 @@
1
- import { Model, Attr, BelongsTo, HasMany } from "spraypaint"
1
+ import { Model, Attr, BelongsTo, HasMany, HasOne } from "spraypaint"
2
2
  import { IModel, PouchCollection, PouchORM } from "pouchorm"
3
3
  import { orderBy } from "lodash"
4
4
  import * as yup from "yup"
@@ -32,6 +32,7 @@ export interface IssueReportPayload {
32
32
  spot?: string
33
33
  areaNature?: "housing" | "other_spots" | "common_areas" | "zone"
34
34
  isTenantRequest?: boolean
35
+ tenantSpot?: string
35
36
  reason?: string
36
37
  origin?: string
37
38
  assignee?: string
@@ -89,6 +90,7 @@ export interface IIssueReport extends IModel {
89
90
  spot?: ISpot | ISpot[]
90
91
  imgs?: string[]
91
92
  isTenantRequest?: boolean
93
+ tenantSpot?: ISpot
92
94
  reason?: IReason
93
95
  origin?: IOrigin
94
96
  assignee?: IUser
@@ -161,6 +163,7 @@ export class SPIssueReportItem
161
163
  @BelongsTo() residence!: IResidence
162
164
  @BelongsTo() place!: SPPlaceItem
163
165
  @BelongsTo() spot!: SPSpotItem
166
+ @BelongsTo() tenantSpot?: SPSpotItem
164
167
  @BelongsTo() company!: SPCompany
165
168
  @BelongsTo() visitReport!: SPVisitReport
166
169
  @BelongsTo() checkpoint!: SPCheckpointItem
@@ -183,6 +186,7 @@ export class SPIssueReportItem
183
186
  priority: yup.number().required(),
184
187
  visitReport: yup.string(),
185
188
  isTenantRequest: yup.boolean(),
189
+ tenantSpot: yup.string().nullable().notRequired()
186
190
  })
187
191
 
188
192
  const isValid = await schema.isValid(payload)