removing unneeded endpoints

This commit is contained in:
José Henrique Ivanchechen 2024-03-24 20:08:07 -03:00
parent e547ae41d4
commit 274fe5252a
6 changed files with 2 additions and 58 deletions

View File

@ -15,18 +15,6 @@ namespace TCC.Controllers
this.ImageService = imageService;
}
[HttpGet("load-small-image")]
public async Task<IActionResult> GetSimpleImage()
{
return File(ImageService.GetSimpleImage(), "image/png");
}
[HttpGet("load-big-image")]
public async Task<IActionResult> GetBigImage()
{
return File(ImageService.GetBigImage(), "image/png");
}
[HttpPost("save-big-image")]
public async Task<IActionResult> SaveBigImage()
{

View File

@ -10,15 +10,5 @@
fileStream.CopyToAsync(file);
file.Close();
}
public byte[] GetSimpleImage()
{
return File.ReadAllBytes("static/small-image.png");
}
public byte[] GetBigImage()
{
return File.ReadAllBytes("static/big-image.png");
}
}
}

View File

@ -64,26 +64,10 @@ async fn simulation_protobuf(msg: ProtoBuf<PersonProtobuf>) -> impl Responder {
HttpResponse::Ok().protobuf(msg.0)
}
#[get("/image/load-small-image")]
async fn load_small_image() -> Result<NamedFile> {
let real_path = "static/small-image.png";
Ok(NamedFile::open(real_path)?)
}
#[get("/image/load-big-image")]
async fn load_big_image() -> Result<NamedFile> {
let real_path = "static/big-image.png";
Ok(NamedFile::open(real_path)?)
}
#[post("/image/save-big-image")]
async fn save_big_image(image_data: web::Bytes) -> Result<HttpResponse> {
// Write bytes to file
std::fs::write("image.png", &image_data).unwrap();
// Return the blurred image bytes
Ok(HttpResponse::Ok()
.content_type("application/json")
.body("{\"status\": 200}"))
@ -97,8 +81,6 @@ async fn main() -> std::io::Result<()> {
App::new()
.route("/static/{filename:.*}", web::get().to(static_serve))
.service(hello)
.service(load_small_image)
.service(load_big_image)
.service(save_big_image)
.service(simulation_harmonic_progression)
.service(simulation_json)

@ -1 +1 @@
Subproject commit 7348eb993c04d60af3da75d7ec8c8f07493911d7
Subproject commit 930a322dfac69d25aa2b91ed478c2c4d46bfc68d

View File

@ -5,22 +5,6 @@ from flask import request, Response, Blueprint, jsonify, send_file
image_blueprint = Blueprint('image_blueprint', __name__)
image_service = ImageService()
@image_blueprint.route('/image/load-small-image', methods=['GET'])
def get_simple_image():
return send_file(io.BytesIO(image_service.get_simple_image()),
mimetype='image/png',
as_attachment=True,
download_name='small-image.png')
@image_blueprint.route('/image/load-big-image', methods=['GET'])
def get_big_image():
return send_file(io.BytesIO(image_service.get_big_image()),
mimetype='image/png',
as_attachment=True,
download_name='big-image.png')
@image_blueprint.route('/image/save-big-image', methods=['POST'])
def save_image():
image_service.save_image(request.get_data())

2
Spring

@ -1 +1 @@
Subproject commit 281dc597169d9934935d7aeed570434f63a3e358
Subproject commit 1c28f5c8e33c96d8389cda306442a8a25fc1e377