|
| 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 | +) |
0 commit comments