Skip to content

Commit

Permalink
fix: misc
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitFicus committed May 14, 2024
1 parent 9db0872 commit c8e3a8c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/fr/maif/izanami/datastores/FeaturesDatastore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class FeaturesDatastore(val env: Env) extends Datastore {
.readTags(tenant, value).flatMap {
case tags if tags.size < value.size => {
val tagsToCreate = value.diff(oldFeature.tags)
env.datastores.tags.createTags(tagsToCreate.map(tag => TagCreationRequest(name = tag)).toList, tenant)
env.datastores.tags.createTags(tagsToCreate.map(tag => TagCreationRequest(name = tag)).toList, tenant, conn=Some(conn))
}
case tags => Right(tags).toFuture
}.flatMap(_ => {
Expand All @@ -267,6 +267,7 @@ class FeaturesDatastore(val env: Env) extends Datastore {
}
)
case Left(err) => Future.successful(Left(err))
case Right(None) => Future.successful(Left(FeatureDoesNotExist(name=id)))
}

case RemoveFeaturePatch(id) => {
Expand Down
7 changes: 4 additions & 3 deletions app/fr/maif/izanami/datastores/TagsDatastore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fr.maif.izanami.env.pgimplicits.EnhancedRow
import fr.maif.izanami.errors.{InternalServerError, IzanamiError, TagDoesNotExists}
import fr.maif.izanami.models.{Tag, TagCreationRequest}
import fr.maif.izanami.utils.Datastore
import io.vertx.sqlclient.Row
import io.vertx.sqlclient.{Row, SqlConnection}

import scala.concurrent.Future

Expand All @@ -27,12 +27,13 @@ class TagsDatastore(val env: Env) extends Datastore {
}
}

def createTags(tags: List[TagCreationRequest], tenant: String): Future[List[Tag]] = {
def createTags(tags: List[TagCreationRequest], tenant: String, conn: Option[SqlConnection] = None): Future[List[Tag]] = {
env.postgresql
.queryAll(
s"""insert into tags (name, description) values (unnest($$1::text[]), unnest($$2::text[])) returning *""",
List(tags.map(_.name).toArray, tags.map(_.description).toArray),
schemas=Set(tenant)
schemas=Set(tenant),
conn=conn
) { row => row.optTag() }
}

Expand Down
1 change: 1 addition & 0 deletions izanami-frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as path from "path";
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 3000,
proxy: {
// string shorthand
"/api": "http://localhost:9000",
Expand Down

0 comments on commit c8e3a8c

Please sign in to comment.