@@ -532,6 +532,106 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
532
532
.futureValue
533
533
response.headOption.isEmpty must be(true )
534
534
}
535
+
536
+ " don't fail when the column is citext or similar, but the value can be interpreted as Int." in withApiClient {
537
+ client =>
538
+ val name = " wiringbits"
539
+
540
+ val request = AdminCreateTable .Request (
541
+ Map (" name" -> name, " email" -> email, " password" -> " wiringbits" )
542
+ )
543
+ client.createItem(usersSettings.tableName, request).futureValue
544
+
545
+ val response = client
546
+ .getTableMetadata(
547
+ usersSettings.tableName,
548
+ List (" email" , " ASC" ),
549
+ List (0 , 9 ),
550
+ """ {"email":"17"}"""
551
+ )
552
+ .futureValue
553
+ val head = response.headOption.value
554
+ val nameValue = head.find(_._1 == " name" ).value._2
555
+ val emailValue = head.find(_._1 == " email" ).value._2
556
+ response.size must be(1 )
557
+ name must be(nameValue)
558
+ email must be(emailValue)
559
+ }
560
+
561
+ " don't fail when the column is citext or similar, but the value can be interpreted as Decimal." in withApiClient {
562
+ client =>
563
+ val name = " wiringbits"
564
+
565
+ val request = AdminCreateTable .Request (
566
+ Map (" name" -> name, " email" -> email, " password" -> " wiringbits" )
567
+ )
568
+ client.createItem(usersSettings.tableName, request).futureValue
569
+
570
+ val response = client
571
+ .getTableMetadata(
572
+ usersSettings.tableName,
573
+ List (" email" , " ASC" ),
574
+ List (0 , 9 ),
575
+ """ {"email":"17.10"}"""
576
+ )
577
+ .futureValue
578
+ val head = response.headOption.value
579
+ val nameValue = head.find(_._1 == " name" ).value._2
580
+ val emailValue = head.find(_._1 == " email" ).value._2
581
+ response.size must be(1 )
582
+ name must be(nameValue)
583
+ email must be(emailValue)
584
+ }
585
+
586
+ " don't fail when the column is citext or similar, but the value can be interpreted as Date." in withApiClient {
587
+ client =>
588
+ val name = " wiringbits"
589
+
590
+ val request = AdminCreateTable .Request (
591
+ Map (" name" -> name, " email" -> email, " password" -> " wiringbits" )
592
+ )
593
+ client.createItem(usersSettings.tableName, request).futureValue
594
+
595
+ val response = client
596
+ .getTableMetadata(
597
+ usersSettings.tableName,
598
+ List (" email" , " ASC" ),
599
+ List (0 , 9 ),
600
+ """ {"email":"2024-06"}"""
601
+ )
602
+ .futureValue
603
+ val head = response.headOption.value
604
+ val nameValue = head.find(_._1 == " name" ).value._2
605
+ val emailValue = head.find(_._1 == " email" ).value._2
606
+ response.size must be(1 )
607
+ name must be(nameValue)
608
+ email must be(emailValue)
609
+ }
610
+
611
+ " don't fail when the column is citext or similar, but the value can be interpreted as UUID." in withApiClient {
612
+ client =>
613
+ val name = " wiringbits"
614
+
615
+ val request = AdminCreateTable .Request (
616
+ Map (" name" -> name, " email" -> email, " password" -> " wiringbits" )
617
+ )
618
+ client.createItem(usersSettings.tableName, request).futureValue
619
+
620
+ val response = client
621
+ .getTableMetadata(
622
+ usersSettings.tableName,
623
+ List (" name" , " ASC" ),
624
+ List (0 , 9 ),
625
+ """ {"email":"8c861a28-e384-4a9b-b7c2-a0367aa3f3e8"}"""
626
+ )
627
+ .futureValue
628
+ val head = response.headOption.value
629
+ val nameValue = head.find(_._1 == " name" ).value._2
630
+ val emailValue = head.find(_._1 == " email" ).value._2
631
+ response.size must be(1 )
632
+ name must be(nameValue)
633
+ email must be(emailValue)
634
+ }
535
635
}
536
636
537
637
" GET /admin/tables/:tableName/:primaryKey" should {
@@ -680,7 +780,7 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
680
780
681
781
responseMetadata.head.nonEmpty mustBe true
682
782
}
683
-
783
+
684
784
" return new user id" in withApiClient { implicit client =>
685
785
val user = createUser.futureValue
686
786
val response = client.getTableMetadata(usersSettings.tableName, List (" name" , " ASC" ), List (0 , 9 ), " {}" ).futureValue
0 commit comments