Skip to content

Commit

Permalink
61 add api for meteo service (#88)
Browse files Browse the repository at this point in the history
* 61 Add api for meteo service

* 61 Update TODO

* 61 MeteoSlaveController
  • Loading branch information
asavershin authored Nov 14, 2024
1 parent 1c5a2de commit ef3e19c
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package agroscience.fields.v2.controllers;

import generated.agroscience.fields.api.MeteoSlaveApi;
import generated.agroscience.fields.api.model.MeteoResponse;
import java.util.List;
import java.util.UUID;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MeteoSlaveController implements MeteoSlaveApi {

@Override
public List<MeteoResponse> coordinatesForMeteoService() {
return List.of();
// TODO Отдавать координаты всех полей, нужно использовать JdbcTemplate. В сервисе можно использовать MeteoResponse
}

}
3 changes: 2 additions & 1 deletion src/main/java/agroscience/fields/v2/security/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class Constants {
"/swagger-ui/**",
"/webjars/**",
"/swagger-ui.html",
"/docs"
"/docs",
"/api/internal/**"
};

}
32 changes: 32 additions & 0 deletions src/main/resources/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,27 @@ paths:
'500':
$ref: '#/components/responses/InternalError'

/api/internal/fields-service/fields/all-coordinates:
get:
tags:
- MeteoSlave
operationId: coordinatesForMeteoService
summary: Get coordinates for meteo service
responses:
'200':
description: List of fields by season with one element list with last crop rotation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MeteoResponse'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalError'


/api/v2/fields-service/contours/{id}/crop-rotation:
post:
tags:
Expand Down Expand Up @@ -638,6 +659,17 @@ components:
- longitude
- latitude

MeteoResponse:
allOf:
- $ref: '#/components/schemas/CoordinatesDTO'
- type: object
properties:
id:
type: string
format: uuid
required:
- id

UpdateContourDTO:
discriminator:
propertyName: contour
Expand Down

0 comments on commit ef3e19c

Please sign in to comment.