quantranhong1999 commented on a change in pull request #707:
URL: https://github.com/apache/james-project/pull/707#discussion_r735245507



##########
File path: 
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/PushSubscription.scala
##########
@@ -42,6 +47,32 @@ case class PushSubscriptionCreationRequest(deviceClientId: 
DeviceClientId,
                                            expires: 
Option[PushSubscriptionExpiredTime],
                                            types: Seq[TypeName])
 
+object PushSubscription {
+  val DEFAULT_VALIDATED: Boolean = false
+  val EXPIRES_TIME_MAX_DAY: Int = 7
+
+  def from(creationRequest: PushSubscriptionCreationRequest,
+           id: PushSubscriptionId,
+           expireTime: ZonedDateTime,
+           verificationCode: VerificationCode): PushSubscription =
+    PushSubscription(id = id,
+      deviceClientId = creationRequest.deviceClientId,
+      url = creationRequest.url,
+      keys = creationRequest.keys,
+      verificationCode = verificationCode,
+      validated = DEFAULT_VALIDATED,
+      expires = PushSubscriptionExpiredTime(expireTime),
+      types = creationRequest.types)
+
+  def invalidExpireTime(time: ZonedDateTime, clock: Clock): Boolean = {
+    val now: ZonedDateTime = ZonedDateTime.now(clock)
+    time.isAfter(now) && time.isBefore(now.plusDays(EXPIRES_TIME_MAX_DAY))

Review comment:
       yes, it should not throw when input expire bigger than max




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to