Skip to content

Commit

Permalink
Fixes after merging final version of BE changes from staging
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoworko committed Oct 22, 2024
1 parent 4639cf3 commit f86a429
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ final case class Comment private (content: String) extends AnyVal {
override def toString: String = content
}

final case class NonEmptyComment private (content: String)

object NonEmptyComment {
def from(comment: Comment): Option[NonEmptyComment] =
if (comment.content.isEmpty) None else Some(NonEmptyComment(comment.content))
}

object Comment {

def from(content: String): Option[Comment] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import akka.http.scaladsl.model.HttpHeader
import com.typesafe.scalalogging.LazyLogging
import db.util.DBIOActionInstances._
import io.circe.generic.JsonCodec
import pl.touk.nussknacker.engine.api.NonEmptyComment
import pl.touk.nussknacker.engine.api.Comment
import pl.touk.nussknacker.engine.api.deployment._
import pl.touk.nussknacker.engine.api.process._
import pl.touk.nussknacker.engine.canonicalgraph.CanonicalProcess
Expand Down Expand Up @@ -69,14 +69,13 @@ object ProcessRepository {
val increaseVersionWhenJsonNotChanged: Boolean
val labels: List[ScenarioLabel]
val forwardedUserName: Option[RemoteUserName]
val comment: Option[NonEmptyComment]
def id: ProcessIdWithName = ProcessIdWithName(processId, canonicalProcess.name)
}

final case class UpdateProcessAction(
protected val processId: ProcessId,
canonicalProcess: CanonicalProcess,
comment: Option[NonEmptyComment],
comment: Option[Comment],
labels: List[ScenarioLabel],
increaseVersionWhenJsonNotChanged: Boolean,
forwardedUserName: Option[RemoteUserName]
Expand All @@ -91,9 +90,7 @@ object ProcessRepository {
sourceEnvironment: String,
targetEnvironment: String,
sourceScenarioVersionId: Option[VersionId],
) extends ModifyProcessAction {
override val comment: Option[NonEmptyComment] = None
}
) extends ModifyProcessAction

final case class AutomaticProcessUpdateAction(
protected val processId: ProcessId,
Expand All @@ -102,9 +99,7 @@ object ProcessRepository {
increaseVersionWhenJsonNotChanged: Boolean,
forwardedUserName: Option[RemoteUserName],
migrationsApplies: List[ProcessMigration]
) extends ModifyProcessAction {
override val comment: Option[NonEmptyComment] = None
}
) extends ModifyProcessAction

final case class ProcessUpdated(processId: ProcessId, oldVersion: Option[VersionId], newVersion: Option[VersionId])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,69 +160,6 @@ trait WithScenarioActivitySpecAsserts
ScenarioActivitiesResponseWrapperForAddedAttachment(response)
}

def verifyAttachmentAddedActivityExists(
user: String,
scenarioName: String,
fileIdPresent: Boolean,
filename: String,
fileStatus: String,
overrideDisplayableName: String,
): ValidatableResponse = {
val fileJson = if (fileIdPresent) {
s"""
|"file": {
| "id": "${regexes.digitsRegex}",
| "status": "$fileStatus"
|}
|""".stripMargin
} else {
s"""
|"file": {
| "status": "$fileStatus"
|}
|""".stripMargin
}
given()
.when()
.basicAuthAllPermUser()
.get(s"$nuDesignerHttpAddress/api/processes/$scenarioName/activity/activities")
.Then()
.statusCode(200)
.body(
matchJsonWithRegexValues(
s"""
|{
| "activities": [
| {
| "id": "${regexes.looseUuidRegex}",
| "user": "admin",
| "date": "${regexes.zuluDateRegex}",
| "scenarioVersionId": 1,
| "additionalFields": [],
| "type": "SCENARIO_CREATED"
| },
| {
| "id": "${regexes.looseUuidRegex}",
| "user": "$user",
| "date": "${regexes.zuluDateRegex}",
| "scenarioVersionId": 1,
| "attachment": {
| $fileJson,
| "filename": "$filename",
| "lastModifiedBy": "$user",
| "lastModifiedAt": "${regexes.zuluDateRegex}"
| },
| "additionalFields": [],
| "overrideDisplayableName": "$overrideDisplayableName",
| "type": "ATTACHMENT_ADDED"
| }
| ]
|}
|""".stripMargin
)
)
}

def verifyEmptyCommentsAndAttachments(scenarioName: String): Unit = {
given()
.when()
Expand Down

0 comments on commit f86a429

Please sign in to comment.