Skip to content

Commit 0ec9267

Browse files
Merge pull request #1092 from GenSpectrum/main
chore: update prod from main
2 parents 06df9ab + 5d4ce2a commit 0ec9267

70 files changed

Lines changed: 2960 additions & 496 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
distribution: 'adopt'
2323

2424
- name: Setup Gradle
25-
uses: gradle/actions/setup-gradle@v5
25+
uses: gradle/actions/setup-gradle@v6
2626

2727
- name: Execute Tests
2828
run: ./gradlew test

.github/workflows/e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ jobs:
3737
run: echo "branchTag=${TAG##*:}" >> $GITHUB_OUTPUT
3838

3939
- name: Wait for website Docker image
40-
uses: lewagon/wait-on-check-action@v1.5.0
40+
uses: lewagon/wait-on-check-action@v1.6.0
4141
with:
4242
ref: ${{ github.sha }}
4343
check-name: Build Website Docker Image
4444
repo-token: ${{ secrets.GITHUB_TOKEN }}
4545
wait-interval: 10
4646
- name: Wait for backend Docker image
47-
uses: lewagon/wait-on-check-action@v1.5.0
47+
uses: lewagon/wait-on-check-action@v1.6.0
4848
with:
4949
ref: ${{ github.sha }}
5050
check-name: Build Backend Docker Image
@@ -65,7 +65,7 @@ jobs:
6565
if: github.ref != 'refs/heads/main'
6666
run: npm run e2e:chromium
6767

68-
- uses: actions/upload-artifact@v6
68+
- uses: actions/upload-artifact@v7
6969
if: ${{ !cancelled() }}
7070
with:
7171
name: playwright-report

backend/README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,40 @@ You have to provide config information to the backend:
1212
* Dashboards configuration, e.g. the LAPIS instances of the organisms.
1313
We have profiles available that only need to be activated via `spring.profiles.active`.
1414
* Database connection configuration: values need to be passed via [external properties](https://docs.spring.io/spring-boot/reference/features/external-config.html).
15-
For local development, we have a `local-db` profile available.
15+
For local development, we have a `local-db` profile available.
1616
You can also check that for required properties.
1717

18+
### Start local database
19+
20+
Start the local PostgreSQL database using Docker Compose (from the repo root):
21+
22+
```bash
23+
docker compose up -d database
24+
```
25+
26+
Stop the database:
27+
28+
```bash
29+
docker compose down database
30+
```
31+
32+
Stop and remove data volumes:
33+
34+
```bash
35+
docker compose down -v database
36+
```
37+
38+
### Run the backend
39+
1840
To run the backend locally, you can use the following command:
1941
```bash
2042
./gradlew bootRun --args='--spring.profiles.active=local-db,dashboards-prod'
2143
```
2244

45+
The backend will be available at:
46+
- Base URL: `http://localhost:8080`
47+
- Swagger UI: `http://localhost:8080/swagger-ui/index.html`
48+
2349
Run tests:
2450

2551
```bash

backend/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ dependencies {
3939
exclude(group = "org.mockito")
4040
}
4141
testImplementation("com.ninja-squad:springmockk:4.0.2")
42-
testImplementation("org.testcontainers:testcontainers:2.0.3")
43-
testImplementation("org.testcontainers:testcontainers-postgresql:2.0.3")
42+
testImplementation("org.testcontainers:testcontainers:2.0.4")
43+
testImplementation("org.testcontainers:testcontainers-postgresql:2.0.4")
4444
testImplementation("org.mock-server:mockserver-netty:5.15.0")
4545
testImplementation("org.mock-server:mockserver-spring-test-listener:5.15.0")
4646

backend/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

backend/gradlew

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package org.genspectrum.dashboardsbackend.api
2+
3+
import io.swagger.v3.oas.annotations.media.Schema
4+
5+
@Schema(
6+
description = "A collection of variants",
7+
example = """
8+
{
9+
"id": 1,
10+
"name": "My Collection",
11+
"ownedBy": "user123",
12+
"organism": "covid",
13+
"description": "A collection of interesting variants",
14+
"variants": []
15+
}
16+
""",
17+
)
18+
data class Collection(
19+
val id: Long,
20+
val name: String,
21+
val ownedBy: String,
22+
val organism: String,
23+
val description: String?,
24+
val variants: List<Variant>,
25+
)
26+
27+
@Schema(
28+
description = "Request to create a collection",
29+
example = """
30+
{
31+
"name": "My Collection",
32+
"organism": "covid",
33+
"description": "A collection of interesting variants",
34+
"variants": [
35+
{
36+
"type": "query",
37+
"name": "BA.2 in USA",
38+
"description": "BA.2 lineage cases in USA",
39+
"countQuery": "country='USA' & lineage='BA.2'",
40+
"coverageQuery": "country='USA'"
41+
}
42+
]
43+
}
44+
""",
45+
)
46+
data class CollectionRequest(
47+
val name: String,
48+
val organism: String,
49+
val description: String? = null,
50+
val variants: List<VariantRequest>,
51+
)
52+
53+
@Schema(
54+
description = "Request to update a collection",
55+
example = """
56+
{
57+
"name": "Updated Collection Name",
58+
"description": "Updated description",
59+
"variants": [
60+
{
61+
"type": "query",
62+
"id": 1,
63+
"name": "BA.2 in USA",
64+
"description": "BA.2 lineage cases in USA",
65+
"countQuery": "country='USA' & lineage='BA.2'",
66+
"coverageQuery": "country='USA'"
67+
},
68+
{
69+
"type": "query",
70+
"name": "New Variant Without ID",
71+
"countQuery": "country='Germany'"
72+
}
73+
]
74+
}
75+
""",
76+
)
77+
data class CollectionUpdate(
78+
val name: String? = null,
79+
val description: String? = null,
80+
val variants: List<VariantUpdate>? = null,
81+
)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package org.genspectrum.dashboardsbackend.api
2+
3+
import com.fasterxml.jackson.annotation.JsonAnyGetter
4+
import com.fasterxml.jackson.annotation.JsonAnySetter
5+
import com.fasterxml.jackson.annotation.JsonInclude
6+
7+
/**
8+
* A JSON object with mutation lists (keys: aminoAcidMutations, nucleotideMutations, ...)
9+
* as well as arbitrary extra properties (e.g. lineage filters) as top-level fields.
10+
* In a validation step, the extra properties are validated to make sure only valid
11+
* fields are used.
12+
*/
13+
@JsonInclude(JsonInclude.Include.NON_NULL)
14+
class FilterObject {
15+
var aminoAcidMutations: List<String>? = null
16+
var nucleotideMutations: List<String>? = null
17+
var aminoAcidInsertions: List<String>? = null
18+
var nucleotideInsertions: List<String>? = null
19+
20+
private val filters: MutableMap<String, String> = mutableMapOf()
21+
22+
@JsonAnyGetter
23+
fun getFilters(): Map<String, String> = filters
24+
25+
@JsonAnySetter
26+
fun set(key: String, value: String) {
27+
filters[key] = value
28+
}
29+
30+
override fun equals(other: Any?): Boolean {
31+
if (this === other) return true
32+
if (other !is FilterObject) return false
33+
return aminoAcidMutations == other.aminoAcidMutations &&
34+
nucleotideMutations == other.nucleotideMutations &&
35+
aminoAcidInsertions == other.aminoAcidInsertions &&
36+
nucleotideInsertions == other.nucleotideInsertions &&
37+
filters == other.filters
38+
}
39+
40+
override fun hashCode(): Int = arrayOf(
41+
aminoAcidMutations,
42+
nucleotideMutations,
43+
aminoAcidInsertions,
44+
nucleotideInsertions,
45+
filters,
46+
).contentHashCode()
47+
}

0 commit comments

Comments
 (0)