Skip to content

Commit

Permalink
refactor(openfeedback): remove java.util.Date usage in Firestore data…
Browse files Browse the repository at this point in the history
… source.
  • Loading branch information
GerardPaligot committed Nov 3, 2023
1 parent e10385a commit be553b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ data class SessionVotes(
)

data class Comment(
val id: String,
val voteItemId: String,
val text: String,
val plus: Long,
val id: String = "",
val voteItemId: String = "",
val text: String = "",
val plus: Long = 0L,
val createdAt: Timestamp,
val updatedAt: Timestamp
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.openfeedback.android.sources

import com.google.firebase.FirebaseApp
import com.google.firebase.firestore.FieldValue
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.FirebaseFirestoreSettings
import io.openfeedback.android.mappers.convertToModel
Expand All @@ -11,7 +12,6 @@ import io.openfeedback.android.toFlow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.tasks.await
import java.util.Date

class OpenFeedbackFirestore(
private val firestore: FirebaseFirestore
Expand Down Expand Up @@ -88,11 +88,11 @@ class OpenFeedbackFirestore(
documentReference.set(
mapOf(
"id" to documentReference.id,
"createdAt" to Date(),
"createdAt" to FieldValue.serverTimestamp(),
"projectId" to projectId,
"status" to status.value,
"talkId" to talkId,
"updatedAt" to Date(),
"updatedAt" to FieldValue.serverTimestamp(),
"userId" to userId,
"voteItemId" to voteItemId,
"text" to text.trim()
Expand All @@ -103,7 +103,7 @@ class OpenFeedbackFirestore(
.document(querySnapshot.documents[0].id)
.update(
mapOf(
"updatedAt" to Date(),
"updatedAt" to FieldValue.serverTimestamp(),
"status" to status.value,
"text" to text.trim()
)
Expand All @@ -130,11 +130,11 @@ class OpenFeedbackFirestore(
documentReference.set(
mapOf(
"id" to documentReference.id,
"createdAt" to Date(),
"createdAt" to FieldValue.serverTimestamp(),
"projectId" to projectId,
"status" to status.value,
"talkId" to talkId,
"updatedAt" to Date(),
"updatedAt" to FieldValue.serverTimestamp(),
"userId" to userId,
"voteItemId" to voteItemId
)
Expand All @@ -144,7 +144,7 @@ class OpenFeedbackFirestore(
.document(querySnapshot.documents[0].id)
.update(
mapOf(
"updatedAt" to Date(),
"updatedAt" to FieldValue.serverTimestamp(),
"status" to status.value
)
)
Expand Down Expand Up @@ -175,8 +175,8 @@ class OpenFeedbackFirestore(
"voteItemId" to voteItemId,
"id" to documentReference.id,
"voteId" to voteId,
"createdAt" to Date(),
"updatedAt" to Date(),
"createdAt" to FieldValue.serverTimestamp(),
"updatedAt" to FieldValue.serverTimestamp(),
"voteType" to "textPlus",
"userId" to userId,
"status" to status.value
Expand All @@ -187,7 +187,7 @@ class OpenFeedbackFirestore(
.document(querySnapshot.documents[0].id)
.update(
mapOf(
"updatedAt" to Date(),
"updatedAt" to FieldValue.serverTimestamp(),
"status" to status.value
)
)
Expand Down

0 comments on commit be553b0

Please sign in to comment.