Skip to content

Commit c0bff98

Browse files
fix nullable fields
1 parent ccd76ba commit c0bff98

8 files changed

Lines changed: 55 additions & 48 deletions

File tree

libraries/data/schemas/com.smarttoolfactory.data.db.PropertyDatabase/1.json

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
"formatVersion": 1,
33
"database": {
44
"version": 1,
5-
"identityHash": "bd4acc865762360a2fb206758c752789",
5+
"identityHash": "15b2cbc83a5ed4f7c8f30f2cb27bd7d2",
66
"entities": [
77
{
88
"tableName": "property",
9-
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `update` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `type` TEXT NOT NULL, `type_id` INTEGER NOT NULL, `thumbnail` TEXT NOT NULL, `thumbnail_big` TEXT NOT NULL, `image_count` INTEGER NOT NULL, `price` TEXT NOT NULL, `price_period` TEXT NOT NULL, `price_period_raw` TEXT NOT NULL, `price_label` TEXT NOT NULL, `price_value` TEXT NOT NULL, `price_value_raw` INTEGER NOT NULL, `currency` TEXT NOT NULL, `featured` INTEGER NOT NULL, `location` TEXT NOT NULL, `area` TEXT NOT NULL, `poa` INTEGER NOT NULL, `rera_permit` TEXT NOT NULL, `bathrooms` TEXT NOT NULL, `bedrooms` TEXT NOT NULL, `date_insert` TEXT NOT NULL, `date_update` TEXT NOT NULL, `agent_name` TEXT NOT NULL, `broker_name` TEXT NOT NULL, `agent_license` TEXT NOT NULL, `location_id` INTEGER NOT NULL, `hide_location` INTEGER NOT NULL, `broker` TEXT NOT NULL, `amenities` TEXT NOT NULL, `amenities_keys` TEXT NOT NULL, `latitude` REAL NOT NULL, `longitude` REAL NOT NULL, `premium` INTEGER NOT NULL, `livingrooms` TEXT NOT NULL, `verified` INTEGER NOT NULL, `gallery` TEXT NOT NULL, `phone` TEXT NOT NULL, `lead_email_receivers` TEXT NOT NULL, `reference` TEXT NOT NULL, PRIMARY KEY(`id`))",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`insert_order` INTEGER NOT NULL, `id` INTEGER NOT NULL, `update` INTEGER NOT NULL, `category_id` INTEGER NOT NULL, `title` TEXT NOT NULL, `subject` TEXT NOT NULL, `type` TEXT NOT NULL, `type_id` INTEGER NOT NULL, `thumbnail` TEXT, `thumbnail_big` TEXT, `image_count` INTEGER NOT NULL, `price` TEXT NOT NULL, `price_period` TEXT, `price_period_raw` TEXT NOT NULL, `price_label` TEXT, `price_value` TEXT, `price_value_raw` INTEGER NOT NULL, `currency` TEXT NOT NULL, `featured` INTEGER NOT NULL, `location` TEXT NOT NULL, `area` TEXT NOT NULL, `poa` INTEGER NOT NULL, `rera_permit` TEXT, `bathrooms` TEXT NOT NULL, `bedrooms` TEXT NOT NULL, `date_insert` TEXT NOT NULL, `date_update` TEXT NOT NULL, `agent_name` TEXT NOT NULL, `broker_name` TEXT NOT NULL, `agent_license` TEXT, `location_id` INTEGER NOT NULL, `hide_location` INTEGER NOT NULL, `broker` TEXT NOT NULL, `amenities` TEXT NOT NULL, `amenities_keys` TEXT NOT NULL, `latitude` REAL NOT NULL, `longitude` REAL NOT NULL, `premium` INTEGER NOT NULL, `livingrooms` TEXT NOT NULL, `verified` INTEGER NOT NULL, `gallery` TEXT, `phone` TEXT NOT NULL, `lead_email_receivers` TEXT NOT NULL, `reference` TEXT NOT NULL, PRIMARY KEY(`insert_order`, `id`))",
1010
"fields": [
11+
{
12+
"fieldPath": "insertOrder",
13+
"columnName": "insert_order",
14+
"affinity": "INTEGER",
15+
"notNull": true
16+
},
1117
{
1218
"fieldPath": "id",
1319
"columnName": "id",
@@ -54,13 +60,13 @@
5460
"fieldPath": "thumbnail",
5561
"columnName": "thumbnail",
5662
"affinity": "TEXT",
57-
"notNull": true
63+
"notNull": false
5864
},
5965
{
6066
"fieldPath": "thumbnailBig",
6167
"columnName": "thumbnail_big",
6268
"affinity": "TEXT",
63-
"notNull": true
69+
"notNull": false
6470
},
6571
{
6672
"fieldPath": "imageCount",
@@ -78,7 +84,7 @@
7884
"fieldPath": "pricePeriod",
7985
"columnName": "price_period",
8086
"affinity": "TEXT",
81-
"notNull": true
87+
"notNull": false
8288
},
8389
{
8490
"fieldPath": "pricePeriodRaw",
@@ -90,13 +96,13 @@
9096
"fieldPath": "priceLabel",
9197
"columnName": "price_label",
9298
"affinity": "TEXT",
93-
"notNull": true
99+
"notNull": false
94100
},
95101
{
96102
"fieldPath": "priceValue",
97103
"columnName": "price_value",
98104
"affinity": "TEXT",
99-
"notNull": true
105+
"notNull": false
100106
},
101107
{
102108
"fieldPath": "priceValueRaw",
@@ -138,7 +144,7 @@
138144
"fieldPath": "reraPermit",
139145
"columnName": "rera_permit",
140146
"affinity": "TEXT",
141-
"notNull": true
147+
"notNull": false
142148
},
143149
{
144150
"fieldPath": "bathrooms",
@@ -180,7 +186,7 @@
180186
"fieldPath": "agentLicense",
181187
"columnName": "agent_license",
182188
"affinity": "TEXT",
183-
"notNull": true
189+
"notNull": false
184190
},
185191
{
186192
"fieldPath": "locationId",
@@ -246,7 +252,7 @@
246252
"fieldPath": "gallery",
247253
"columnName": "gallery",
248254
"affinity": "TEXT",
249-
"notNull": true
255+
"notNull": false
250256
},
251257
{
252258
"fieldPath": "phone",
@@ -269,6 +275,7 @@
269275
],
270276
"primaryKey": {
271277
"columnNames": [
278+
"insert_order",
272279
"id"
273280
],
274281
"autoGenerate": false
@@ -280,7 +287,7 @@
280287
"views": [],
281288
"setupQueries": [
282289
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
283-
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'bd4acc865762360a2fb206758c752789')"
290+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '15b2cbc83a5ed4f7c8f30f2cb27bd7d2')"
284291
]
285292
}
286293
}

libraries/data/src/main/java/com/smarttoolfactory/data/db/PropertyTypeConverters.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ import com.smarttoolfactory.data.model.local.BrokerEntity
88
class PropertyTypeConverters {
99

1010
@TypeConverter
11-
fun fromBrokerEntity(data: BrokerEntity): String {
11+
fun fromBrokerEntity(data: BrokerEntity?): String? {
1212
return Gson().toJson(data)
1313
}
1414

1515
@TypeConverter
16-
fun toBrokerEntity(json: String): BrokerEntity {
16+
fun toBrokerEntity(json: String?): BrokerEntity? {
1717
return Gson().fromJson(json, BrokerEntity::class.java)
1818
}
1919

2020
@TypeConverter
21-
fun fromStringList(list: List<String>): String {
21+
fun fromStringList(list: List<String?>?): String? {
2222
return Gson().toJson(list)
2323
}
2424

2525
@TypeConverter
26-
fun toStringList(json: String): List<String> {
26+
fun toStringList(json: String?): List<String?>? {
2727
val listType = object : TypeToken<ArrayList<String>>() {}.type
2828
return Gson().fromJson(json, listType)
2929
}

libraries/data/src/main/java/com/smarttoolfactory/data/model/local/BrokerEntity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ data class BrokerEntity(
1111
val email: String,
1212

1313
val mobile: String?,
14-
val agentPhoto: String,
14+
val agentPhoto: String?,
1515
val agentName: String,
1616

1717
val leadEmailReceivers: List<String>,
18-
val license: String,
18+
val license: String?,
1919
val agentId: Int,
20-
val logo: String
20+
val logo: String?
2121
) : IEntity

libraries/data/src/main/java/com/smarttoolfactory/data/model/local/PropertyEntity.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ data class PropertyEntity(
3131
@ColumnInfo(name = "type_id")
3232
val typeId: Int,
3333
@ColumnInfo(name = "thumbnail")
34-
val thumbnail: String,
34+
val thumbnail: String?,
3535
@ColumnInfo(name = "thumbnail_big")
36-
val thumbnailBig: String,
36+
val thumbnailBig: String?,
3737
@ColumnInfo(name = "image_count")
3838
val imageCount: Int,
3939
@ColumnInfo(name = "price")
4040
val price: String,
4141
@ColumnInfo(name = "price_period")
42-
val pricePeriod: String,
42+
val pricePeriod: String?,
4343
@ColumnInfo(name = "price_period_raw")
4444
val pricePeriodRaw: String,
4545
@ColumnInfo(name = "price_label")
46-
val priceLabel: String,
46+
val priceLabel: String?,
4747
@ColumnInfo(name = "price_value")
48-
val priceValue: String,
48+
val priceValue: String?,
4949
@ColumnInfo(name = "price_value_raw")
5050
val priceValueRaw: Int,
5151
@ColumnInfo(name = "currency")
@@ -59,7 +59,7 @@ data class PropertyEntity(
5959
@ColumnInfo(name = "poa")
6060
val poa: Boolean,
6161
@ColumnInfo(name = "rera_permit")
62-
val reraPermit: String,
62+
val reraPermit: String?,
6363
@ColumnInfo(name = "bathrooms")
6464
val bathrooms: String,
6565
@ColumnInfo(name = "bedrooms")
@@ -73,7 +73,7 @@ data class PropertyEntity(
7373
@ColumnInfo(name = "broker_name")
7474
val brokerName: String,
7575
@ColumnInfo(name = "agent_license")
76-
val agentLicense: String,
76+
val agentLicense: String?,
7777
@ColumnInfo(name = "location_id")
7878
val locationId: Int,
7979
@ColumnInfo(name = "hide_location")
@@ -98,7 +98,7 @@ data class PropertyEntity(
9898
val verified: Boolean,
9999

100100
@ColumnInfo(name = "gallery")
101-
val gallery: List<String>,
101+
val gallery: List<String>?,
102102
@ColumnInfo(name = "phone")
103103
val phone: String,
104104

libraries/data/src/main/java/com/smarttoolfactory/data/model/remote/BrokerDTO.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ data class BrokerDTO(
2121
val mobile: String?,
2222

2323
@SerializedName("agent_photo")
24-
val agentPhoto: String,
24+
val agentPhoto: String?,
2525
@SerializedName("agent_name")
2626
val agentName: String,
2727

2828
@SerializedName("lead_email_receivers")
2929
val leadEmailReceivers: List<String>,
3030
@SerializedName("license")
31-
val license: String,
31+
val license: String?,
3232
@SerializedName("agent_id")
3333
val agentId: Int,
3434
@SerializedName("logo")
35-
val logo: String
35+
val logo: String?
3636
) : DataTransferObject

libraries/data/src/main/java/com/smarttoolfactory/data/model/remote/PropertyDTO.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ data class PropertyDTO(
1919
@SerializedName("type_id")
2020
val typeId: Int,
2121
@SerializedName("thumbnail")
22-
val thumbnail: String,
22+
val thumbnail: String?,
2323
@SerializedName("thumbnail_big")
24-
val thumbnailBig: String,
24+
val thumbnailBig: String?,
2525
@SerializedName("image_count")
2626
val imageCount: Int,
2727
@SerializedName("price")
2828
val price: String,
2929
@SerializedName("price_period")
30-
val pricePeriod: String,
30+
val pricePeriod: String?,
3131
@SerializedName("price_period_raw")
3232
val pricePeriodRaw: String,
3333
@SerializedName("price_label")
34-
val priceLabel: String,
34+
val priceLabel: String?,
3535
@SerializedName("price_value")
36-
val priceValue: String,
36+
val priceValue: String?,
3737
@SerializedName("price_value_raw")
3838
val priceValueRaw: Int,
3939
@SerializedName("currency")
@@ -47,7 +47,7 @@ data class PropertyDTO(
4747
@SerializedName("poa")
4848
val poa: Boolean,
4949
@SerializedName("rera_permit")
50-
val reraPermit: String,
50+
val reraPermit: String?,
5151
@SerializedName("bathrooms")
5252
val bathrooms: String,
5353
@SerializedName("bedrooms")
@@ -61,7 +61,7 @@ data class PropertyDTO(
6161
@SerializedName("broker_name")
6262
val brokerName: String,
6363
@SerializedName("agent_license")
64-
val agentLicense: String,
64+
val agentLicense: String?,
6565
@SerializedName("location_id")
6666
val locationId: Int,
6767
@SerializedName("hide_location")
@@ -88,7 +88,7 @@ data class PropertyDTO(
8888
val verified: Boolean,
8989
@SerializedName("gallery")
9090

91-
val gallery: List<String>,
91+
val gallery: List<String>?,
9292
@SerializedName("phone")
9393
val phone: String,
9494

libraries/domain/src/main/java/com/smarttoolfactory/domain/model/BrokerItem.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ data class BrokerItem(
1313
val email: String,
1414

1515
val mobile: String?,
16-
val agentPhoto: String,
16+
val agentPhoto: String?,
1717
val agentName: String,
1818

1919
val leadEmailReceivers: List<String>,
20-
val license: String,
20+
val license: String?,
2121
val agentId: Int,
22-
val logo: String
22+
val logo: String?
2323
) : Item, Parcelable

libraries/domain/src/main/java/com/smarttoolfactory/domain/model/PropertyItem.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ data class PropertyItem(
1616
val subject: String,
1717
val type: String,
1818
val typeId: Int,
19-
val thumbnail: String,
20-
val thumbnailBig: String,
19+
val thumbnail: String?,
20+
val thumbnailBig: String?,
2121
val imageCount: Int,
2222
val price: String,
23-
val pricePeriod: String,
23+
val pricePeriod: String?,
2424
val pricePeriodRaw: String,
25-
val priceLabel: String,
26-
val priceValue: String,
25+
val priceLabel: String?,
26+
val priceValue: String?,
2727
val priceValueRaw: Int,
2828
val currency: String,
2929
val featured: Boolean,
3030
val location: String,
3131
val area: String,
3232
val poa: Boolean,
33-
val reraPermit: String,
33+
val reraPermit: String?,
3434
val bathrooms: String,
3535
val bedrooms: String,
3636
val dateInsert: String,
3737
val dateUpdate: String,
3838
val agentName: String,
3939
val brokerName: String,
40-
val agentLicense: String,
40+
val agentLicense: String?,
4141
val locationId: Int,
4242
val hideLocation: Boolean,
4343

@@ -51,7 +51,7 @@ data class PropertyItem(
5151
val livingrooms: String,
5252
val verified: Boolean,
5353

54-
val gallery: List<String>,
54+
val gallery: List<String>?,
5555
val phone: String,
5656

5757
val leadEmailReceivers: List<String>,

0 commit comments

Comments
 (0)