-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d72aa61
commit a422cb8
Showing
15 changed files
with
194 additions
and
49 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
26 changes: 26 additions & 0 deletions
26
app/src/main/java/org/fossasia/openevent/general/event/subtopic/EventSubTopic.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.fossasia.openevent.general.event.subtopic | ||
|
||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.ForeignKey | ||
import androidx.room.PrimaryKey | ||
import com.github.jasminb.jsonapi.LongIdHandler | ||
import com.github.jasminb.jsonapi.annotations.Id | ||
import com.github.jasminb.jsonapi.annotations.Relationship | ||
import com.github.jasminb.jsonapi.annotations.Type | ||
import org.fossasia.openevent.general.event.Event | ||
import org.fossasia.openevent.general.event.EventId | ||
|
||
@Type("event-sub-topic") | ||
@Entity(foreignKeys = [(ForeignKey(entity = Event::class, parentColumns = ["id"], | ||
childColumns = ["event"], onDelete = ForeignKey.CASCADE))]) | ||
data class EventSubTopic( | ||
@Id(LongIdHandler::class) | ||
@PrimaryKey | ||
val id: Long, | ||
val name: String, | ||
val slug: String, | ||
@ColumnInfo(index = true) | ||
@Relationship("event") | ||
var event: EventId? = null | ||
) |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/org/fossasia/openevent/general/event/subtopic/EventSubTopicConverter.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.fossasia.openevent.general.event.subtopic | ||
|
||
import androidx.room.TypeConverter | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
|
||
class EventSubTopicConverter { | ||
|
||
@TypeConverter | ||
fun toEventSubTopic(json: String): EventSubTopic? { | ||
return ObjectMapper().readerFor(EventSubTopic::class.java).readValue<EventSubTopic>(json) | ||
} | ||
|
||
@TypeConverter | ||
fun toJson(eventSubTopic: EventSubTopic?) = ObjectMapper().writeValueAsString(eventSubTopic) | ||
} |
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
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/fossasia/openevent/general/event/topic/EventTopicConverter.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.fossasia.openevent.general.event.topic | ||
|
||
import androidx.room.TypeConverter | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
|
||
class EventTopicConverter { | ||
@TypeConverter | ||
fun toEventTopic(json: String): EventTopic? { | ||
return ObjectMapper().readerFor(EventTopic::class.java).readValue<EventTopic>(json) | ||
} | ||
|
||
@TypeConverter | ||
fun toJson(eventTopic: EventTopic?) = ObjectMapper().writeValueAsString(eventTopic) | ||
} |
20 changes: 0 additions & 20 deletions
20
app/src/main/java/org/fossasia/openevent/general/event/topic/EventTopicIdConverter.kt
This file was deleted.
Oops, something went wrong.
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
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/fossasia/openevent/general/event/types/EventTypeConverter.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.fossasia.openevent.general.event.types | ||
|
||
import androidx.room.TypeConverter | ||
import com.fasterxml.jackson.databind.ObjectMapper | ||
|
||
class EventTypeConverter { | ||
@TypeConverter | ||
fun toEventType(json: String): EventType? { | ||
return ObjectMapper().readerFor(EventType::class.java).readValue<EventType>(json) | ||
} | ||
|
||
@TypeConverter | ||
fun toJson(eventType: EventType?) = ObjectMapper().writeValueAsString(eventType) | ||
} |
Oops, something went wrong.