Last active
July 30, 2019 10:01
-
-
Save Papashkin/7363c572244f187042b79c988659139a to your computer and use it in GitHub Desktop.
POJO + Converters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "string", | |
"notifications": [ | |
{ | |
"content": "string", | |
"contentDates": [ | |
null | |
], | |
"id": "string", | |
"relatedEntity": { | |
"entityId": "string", | |
"type": "REMARK" | |
}, | |
"senderId": "string", | |
"viewDate": "2019-07-30T09:56:43.552Z", | |
"viewed": true | |
} | |
], | |
"organizations": [ | |
{ | |
"code": 0, | |
"fullName": "string", | |
"id": "string", | |
"name": "string", | |
"position": "string", | |
"projectIds": [ | |
"string" | |
] | |
} | |
], | |
"projects": [ | |
{ | |
"buildingObjects": [ | |
{ | |
"id": "string", | |
"name": "string" | |
} | |
], | |
"id": "string", | |
"name": "string", | |
"remarks": [ | |
{ | |
"authorOrganizationId": "string", | |
"authorUserId": "string", | |
"contractorOrganizationId": "string", | |
"contractorUserId": "string", | |
"description": "string", | |
"executionDate": "2019-07-30T09:56:43.552Z", | |
"executorOrganizationId": "string", | |
"executorUserId": "string", | |
"id": "string", | |
"name": "string", | |
"number": "string", | |
"priority": "CRITICAL", | |
"registrationDate": "2019-07-30T09:56:43.552Z" | |
} | |
] | |
} | |
], | |
"systemTime": 0, | |
"user": { | |
"deleted": true, | |
"email": "string", | |
"firstName": "string", | |
"id": "string", | |
"middleName": "string", | |
"permissions": [ | |
"string" | |
], | |
"secondName": "string" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PriorityTypeConverter { | |
@TypeConverter | |
fun fromPriority(status: Priority): String = status.name | |
@TypeConverter | |
fun toPriority(name: String): Priority = Priority.valueOf(name) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity(tableName = "projects") | |
@TypeConverters(RemarksTypeConverter::class, BuildingObjectsTypeConverter::class) | |
class Project { | |
@PrimaryKey | |
@SerializedName("id") | |
@ColumnInfo(name = "id") | |
var id: String = "" | |
@SerializedName("name") | |
@ColumnInfo(name = "name") | |
var name: String? = "Ants Inc." | |
@SerializedName("remarks") | |
@ColumnInfo(name = "remarks") | |
var remarks: List<Remark>? = listOf() | |
@SerializedName("buildingObjects") | |
@ColumnInfo(name = "buildingObjects") | |
var buildingObjects: List<BuildingObject>? = listOf() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity(tableName = "remarks") | |
@TypeConverters(PriorityTypeConverter::class, DateFormatConverter::class, RemarkStatusTypeConverter::class, StringListToStringConverter::class) | |
class Remark { | |
@PrimaryKey | |
@SerializedName("id") | |
@ColumnInfo(name = "id") | |
var id: String = "" | |
@SerializedName("name") | |
@ColumnInfo(name = "name") | |
var name: String? = "" | |
@SerializedName("number") | |
@ColumnInfo(name = "number") | |
var number: String? = "" | |
@SerializedName("priority") | |
@ColumnInfo(name = "priority") | |
var priority: Priority? = Priority.CRITICAL | |
@SerializedName("registrationDate") | |
@ColumnInfo(name = "registrationDate") | |
var registrationDate: Date? = Date() | |
@SerializedName("executionDate") | |
@ColumnInfo(name = "executionDate") | |
var executionDate: Date? = Date() | |
@SerializedName("description") | |
@ColumnInfo(name = "description") | |
var description: String? = "" | |
@SerializedName("authorOrganizationId") | |
@ColumnInfo(name = "authorOrganizationId") | |
var authorOrganizationId: String? = "" | |
@SerializedName("authorUserId") | |
@ColumnInfo(name = "authorUserId") | |
var authorUserId: String? = "" | |
@SerializedName("contractorOrganizationId") | |
@ColumnInfo(name = "contractorOrganizationId") | |
var contractorOrganizationId: String? = "" | |
@SerializedName("contractorUserId") | |
@ColumnInfo(name = "contractorUserId") | |
var contractorUserId: String? = "" | |
@SerializedName("executorOrganizationId") | |
@ColumnInfo(name = "executorOrganizationId") | |
var executorOrganizationId: String? = "" | |
@SerializedName("executorUserId") | |
@ColumnInfo(name = "executorUserId") | |
var executorUserId: String? = "" | |
@SerializedName("status") | |
@ColumnInfo(name = "status") | |
var status: RemarkStatus? = RemarkStatus.DRAFT | |
@SerializedName("photos") | |
@ColumnInfo(name = "photos") | |
var photos: List<String>? = listOf() | |
@SerializedName("projectId") | |
@ColumnInfo(name = "projectId") | |
var projectId: String = "" | |
@SerializedName("buildingObjectId") | |
@ColumnInfo(name = "buildingObjectId") | |
var buildingObjectId: String? = "" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UpdateResponse { | |
@SerializedName("id") | |
val id: String? = "" | |
@SerializedName("organizations") | |
val userOrganizations: List<UserOrganizations>? = listOf() | |
@SerializedName("projects") | |
val projects: List<Project>? = listOf() | |
@SerializedName("user") | |
val user: User = User() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment