-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from mayorJAY/feat-modify-field-data-type
Modify Field Data Types
- Loading branch information
Showing
3 changed files
with
60 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package co.novu.dto.request | ||
|
||
import co.novu.dto.Tenant | ||
|
||
abstract class BaseEventRequest { | ||
|
||
// Mandatory fields | ||
|
@@ -9,16 +11,40 @@ abstract class BaseEventRequest { | |
// Optional fields | ||
private var overrides: Map<String, Any>? = null | ||
private var transactionId: String? = null | ||
private var actor: String? = null | ||
private var tenant: String? = null | ||
|
||
/** | ||
* Possible types this field accepts are; String or [Map] | ||
* | ||
* For example: | ||
* | ||
* actor = mapOf( | ||
* "subscriberId" to "sId", | ||
* "email" to "[email protected]", | ||
* "firstName" to "fName", | ||
* "lastName" to "lName", | ||
* "phone" to "phoneNo") | ||
*/ | ||
private var actor: Any? = null | ||
|
||
/** | ||
* Possible types this field accepts are; String or [Tenant] | ||
* | ||
* For example: | ||
* | ||
* tenant = Tenant( | ||
* identifier = "identifier", | ||
* name = "name", | ||
* data = Any()) | ||
*/ | ||
private var tenant: Any? = null | ||
|
||
protected fun init( | ||
name: String, | ||
payload: Map<String, Any>, | ||
overrides: Map<String, Any>? = null, | ||
transactionId: String? = null, | ||
actor: String? = null, | ||
tenant: String? = null | ||
actor: Any? = null, | ||
tenant: Any? = null | ||
): BaseEventRequest { | ||
return this.apply { | ||
this.name = 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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import co.novu.Novu | ||
import co.novu.NovuConfig | ||
import co.novu.dto.Tenant | ||
import co.novu.dto.Topic | ||
import co.novu.dto.request.BroadcastEventRequest | ||
import co.novu.dto.request.BulkTriggerEventRequest | ||
|
@@ -50,7 +51,14 @@ class EventsApiTest { | |
lastName = "Doe" | ||
), | ||
payload = mapOf("customVariables" to "Hello"), | ||
transactionId = "transactionId" | ||
transactionId = "transactionId", | ||
actor = mapOf( | ||
"subscriberId" to "sId", | ||
"email" to "[email protected]", | ||
"firstName" to "fName", | ||
"lastName" to "lName", | ||
"phone" to "phoneNo" | ||
) | ||
) | ||
val result = mockNovu.trigger(requestBody) | ||
val request = mockWebServer.takeRequest() | ||
|
@@ -84,7 +92,12 @@ class EventsApiTest { | |
) | ||
), | ||
payload = mapOf("customVariables" to "Hello"), | ||
transactionId = "transactionId" | ||
transactionId = "transactionId", | ||
tenant = Tenant( | ||
identifier = "identifier", | ||
name = "name", | ||
data = Any() | ||
) | ||
) | ||
val result = mockNovu.trigger(requestBody) | ||
val request = mockWebServer.takeRequest() | ||
|