Добавлен сервис и контроллер для QR кода

This commit is contained in:
Daniil Makeev 2025-02-19 10:33:44 +03:00
parent b20455cb7b
commit 61b23d9afb
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package com.example.onomatopoeiaback.controller;
import com.example.onomatopoeiaback.domain.qrcode.QrCode;
import com.example.onomatopoeiaback.service.QrCodeService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/qr_code")
public class QrCodeController {
final
QrCodeService qrCodeService;
public QrCodeController(QrCodeService qrCodeService) {
this.qrCodeService = qrCodeService;
}
public ResponseEntity<QrCode> createQrCode(@RequestParam String name) {
return ResponseEntity.ok(qrCodeService.createQrCode(name));
}
}

View File

@ -0,0 +1,13 @@
package com.example.onomatopoeiaback.service;
import com.example.onomatopoeiaback.domain.qrcode.QrCode;
import org.springframework.stereotype.Service;
@Service
public class QrCodeService {
public QrCode createQrCode(String name) {
QrCode qrCode = new QrCode();
qrCode.setName(name);
return qrCode;
}
}