# ktor


09/13/2021, 3:40 AM
Hello all, I have a model in my android project that has a type converter of a custom class. My android project has a backend built on ktor. The kto project also has a similar model and am using postress database for storage. The problem that i am facing is storing the type converted class inside my postgress alongside other attributes. Here is the models of the two. Thanks in advance. Android model
Copy code
@Entity(tableName = "requests")
public class Request extends BaseObservable implements Parcelable {
    @PrimaryKey(autoGenerate = true)
    private int request_id;// Document_id

    private String r_clients_id;
    private int r_tasker_id;
    private User user;// Type converter 
    private String requested_skill;
    private String time_stamp;
Same model for my ktor project
Copy code
class Request(
    val request_id: Int,

    val r_clients_id: Int,
    val r_tasker_id: Int,
    val user: User,
    val requested_skill: String,
    val time_stamp: String,
    val arrival_date: String,
): Serializable, Principal
Here is where am facing the challenge. I really don't know how to insert or reference the Type converter class in my object class.
Copy code
object Requests : Table() {
    val requestId: Column<Int> = integer("request_id").autoIncrement().primaryKey()
    val rClientId: Column<Int> = integer("r_clients_id").references(Users.userId)
    val rTaskerId: Column<Int> = integer("r_tasker_id").references(Taskers.taskerId)
    val user: Column<User> = ?????????????????????????

    val requestedSkill = varchar("requested_skill", 128)
    val timeStamp = varchar("time_stamp", 64)
    val arrivalDate = varchar("arrival_date", 64)

Aleksei Tirman [JB]

09/13/2021, 10:42 AM
Could you please explain why would you need to store a type converter and what is it?


09/13/2021, 11:55 AM
We have type converters in android.where by you include an object in another model. As for my case i have a user model and a request model. In my request model I want to fetch the request and get the name of the user that made the request.This makes it easier by including the user model in the request. The problem that i am facing is storing that in my postgress database in ktor.