From 0dcba28f583240ec5c4e50b303dfa25578a810f1 Mon Sep 17 00:00:00 2001 From: 201724554 Date: Fri, 10 Feb 2023 13:54:18 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat(BE):=20dto=20=EB=B0=8F=20=EA=B8=B0?= =?UTF-8?q?=ED=94=84=ED=8B=B0=EC=BD=98=20=EA=B0=9D=EC=B2=B4=EC=97=90=20thu?= =?UTF-8?q?mbnail=20=EB=A9=A4=EB=B2=84=20=EB=B3=80=EC=88=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/amatta/amatta_server/gifticon/dto/GifticonDto.java | 2 ++ .../com/amatta/amatta_server/gifticon/model/Gifticon.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/dto/GifticonDto.java b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/dto/GifticonDto.java index 04e3af1..da0162b 100644 --- a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/dto/GifticonDto.java +++ b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/dto/GifticonDto.java @@ -12,6 +12,8 @@ public class GifticonDto { @NotEmpty private String image; @NotEmpty + private String thumbnail; + @NotEmpty private String barcode; @NotEmpty private String expiresAtInString; diff --git a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/model/Gifticon.java b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/model/Gifticon.java index 06db8ee..09b3905 100644 --- a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/model/Gifticon.java +++ b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/model/Gifticon.java @@ -10,6 +10,7 @@ public class Gifticon { private long id; private long uid; private byte[] image; + private byte[] thumbnail; private String brandname; private String itemname; private String barcode; @@ -29,6 +30,10 @@ public byte[] getImage() { return image; } + public byte[] getThumbnail() { + return thumbnail; + } + public String getBrandName() { return brandname; } From a7fbf36f2202cdb68d280d27ffedbcbd6c3df5b4 Mon Sep 17 00:00:00 2001 From: 201724554 Date: Fri, 10 Feb 2023 13:56:09 +0900 Subject: [PATCH 2/6] =?UTF-8?q?feat(BE)=20:=20dto=EC=97=90=EC=84=9C=20thum?= =?UTF-8?q?bnail=EB=8F=84=20=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(#99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../amatta/amatta_server/gifticon/service/GifticonService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/service/GifticonService.java b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/service/GifticonService.java index b3c3b26..da2032c 100644 --- a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/service/GifticonService.java +++ b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/service/GifticonService.java @@ -61,6 +61,7 @@ public Gifticon mapTextToGifticon(GifticonTextDto dto) throws NullPointerExcepti public void addGifticon(GifticonDto dto) throws DuplicateGifticonException { long uid = getUserBySessionId().getId(); byte[] image = dto.getImage().getBytes(); + byte[] thumbnail = dto.getThumbnail().getBytes(); String brandName = dto.getBrandName(); String itemName = dto.getItemName(); String barcode = dto.getBarcode(); @@ -75,6 +76,7 @@ public void addGifticon(GifticonDto dto) throws DuplicateGifticonException { gifticonRepository.addGifticon( uid, image, + thumbnail, brandName, itemName, barcode, From 8dd28bc5b6b266ff917e3676db994220b85c7ff9 Mon Sep 17 00:00:00 2001 From: 201724554 Date: Fri, 10 Feb 2023 13:56:49 +0900 Subject: [PATCH 3/6] =?UTF-8?q?feat(BE)=20:=20thumbnail=EC=9D=84=20?= =?UTF-8?q?=ED=8F=AC=ED=95=A8=ED=95=98=EB=8F=84=EB=A1=9D=20insert=20sql=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gifticon/repository/GifticonRepository.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java index 9c214e7..3dfbabd 100644 --- a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java +++ b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/repository/GifticonRepository.java @@ -25,6 +25,7 @@ public interface GifticonRepository extends CrudRepository { "itemName, " + "brandName, " + "image, " + + "thumbnail, " + "barcode, " + "price, " + "expiresAt, " + @@ -33,11 +34,12 @@ public interface GifticonRepository extends CrudRepository { Optional findById(@Param("id") long id); @Modifying - @Query("INSERT INTO gifticon(uid, image, brandName, itemName, barcode, expiresAt, usedAt, price)" + - " VALUES (:uid, :image, :brandName, :itemName, :barcode, :expiresAt, :usedAt, :price)") + @Query("INSERT INTO gifticon(uid, image, thumbnail, brandName, itemName, barcode, expiresAt, usedAt, price)" + + " VALUES (:uid, :image, :thumbnail, :brandName, :itemName, :barcode, :expiresAt, :usedAt, :price)") void addGifticon( @Param("uid") long uid, @Param("image") byte[] image, + @Param("thumbnail") byte[] thumbnail, @Param("brandName") String brandName, @Param("itemName") String itemName, @Param("barcode") String barcode, @@ -52,6 +54,7 @@ void addGifticon( "itemName, " + "brandName, " + "image, " + + "thumbnail, " + "barcode, " + "price, " + "expiresAt, " + From 278cb3d09816cce90ac08edbe19ada64888e715f Mon Sep 17 00:00:00 2001 From: 201724554 Date: Fri, 10 Feb 2023 13:57:47 +0900 Subject: [PATCH 4/6] =?UTF-8?q?feat(BE)=20:=20CrossOrigin=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=EC=9D=98=20origins?= =?UTF-8?q?=EB=A5=BC=20=EB=8F=84=EB=A9=94=EC=9D=B8=20=EB=AA=85=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../amatta_server/gifticon/controller/GifticonController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/controller/GifticonController.java b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/controller/GifticonController.java index 36d9e81..7638d8c 100644 --- a/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/controller/GifticonController.java +++ b/amatta_server/src/main/java/com/amatta/amatta_server/gifticon/controller/GifticonController.java @@ -17,7 +17,7 @@ import javax.validation.Valid; @RestController -@CrossOrigin(origins = "http://15.164.13.149:5173/", allowCredentials = "true") +@CrossOrigin(origins = "https://amatta.site/", allowCredentials = "true") @RequestMapping("/gifticon") public class GifticonController { private final GifticonService gifticonService; From 18ca7cfd9db69cb86252117dc8957618a91277d7 Mon Sep 17 00:00:00 2001 From: 201724554 Date: Fri, 10 Feb 2023 13:58:29 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat(BE)=20:=20=EB=8D=B0=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=20=EC=82=BD=EC=9E=85=20=EB=B6=80=EB=B6=84=EC=97=90=20thumbnail?= =?UTF-8?q?=EC=9D=84=20=ED=8F=AC=ED=95=A8=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/amatta/amatta_server/GifticonControllerTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/amatta_server/src/test/java/com/amatta/amatta_server/GifticonControllerTest.java b/amatta_server/src/test/java/com/amatta/amatta_server/GifticonControllerTest.java index 68184e1..2e25315 100644 --- a/amatta_server/src/test/java/com/amatta/amatta_server/GifticonControllerTest.java +++ b/amatta_server/src/test/java/com/amatta/amatta_server/GifticonControllerTest.java @@ -58,6 +58,7 @@ public void GifticonAddRequest() throws Exception { "\"itemName\": \"아메리카노\", " + "\"brandName\": \"스타벅스\", " + "\"image\": \"adfadf\", " + + "\"thumbnail\": \"adfadfa\", " + "\"price\": \"3000\", " + "\"barcode\": \"12341234\", " + "\"expiresAtInString\": \"2023/11/11\"" + @@ -78,6 +79,7 @@ public void DuplicateBarcodeGifticonAddRequest() throws Exception { "\"itemName\": \"아메리카노\", " + "\"brandName\": \"스타벅스\", " + "\"image\": \"adfadf\", " + + "\"thumbnail\": \"adfadfa\", " + "\"price\": \"3000\", " + "\"barcode\": \"12341234\", " + "\"expiresAtInString\": \"2023/11/11\"" + @@ -103,6 +105,7 @@ public void BarcodeGifticonAddRequestWithNullAttr() throws Exception { String requestBody = "{" + "\"itemName\": \"아메리카노\", " + "\"image\": \"adfadf\", " + + "\"thumbnail\": \"adfadfa\", " + "\"price\": \"3000\", " + "\"barcode\": \"12341234\", " + "\"expiresAtInString\": \"2023/11/11\"" + @@ -129,6 +132,7 @@ public void GifticonListTest() throws Exception { "\"itemName\": \"아메리카노\", " + "\"brandName\": \"스타벅스\", " + "\"image\": \"adfadf\", " + + "\"thumbnail\": \"adfadfa\", " + "\"price\": \"3000\", " + "\"barcode\": \"12341234000\", " + "\"expiresAtInString\": \"2023/11/11\"" + @@ -144,6 +148,7 @@ public void GifticonListTest() throws Exception { "\"itemName\": \"아메리카노\", " + "\"brandName\": \"스타벅스\", " + "\"image\": \"adfadf\", " + + "\"thumbnail\": \"adfadfa\", " + "\"price\": \"3000\", " + "\"barcode\": \"109123124\", " + "\"expiresAtInString\": \"2023/11/11\"" + @@ -170,6 +175,7 @@ public void GifticonUseTest() throws Exception { "\"itemName\": \"아메리카노\", " + "\"brandName\": \"스타벅스\", " + "\"image\": \"adfadf\", " + + "\"thumbnail\": \"adfadfa\", " + "\"price\": \"3000\", " + "\"barcode\": \"12341234000\", " + "\"expiresAtInString\": \"2023/11/11\"" + From fb1c395c9cb2e7e0600cdf913100c4a6d13534f7 Mon Sep 17 00:00:00 2001 From: 201724554 Date: Fri, 10 Feb 2023 13:58:58 +0900 Subject: [PATCH 6/6] =?UTF-8?q?feat(BE)=20:=20firebase=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80=20(#99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- amatta_server/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/amatta_server/build.gradle b/amatta_server/build.gradle index ed84da1..b00d1f3 100644 --- a/amatta_server/build.gradle +++ b/amatta_server/build.gradle @@ -10,6 +10,7 @@ sourceCompatibility = '11' repositories { mavenCentral() + google() } dependencies { @@ -35,6 +36,9 @@ dependencies { annotationProcessor('org.projectlombok:lombok') testAnnotationProcessor('org.projectlombok:lombok') compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24' + + implementation group: 'com.google.firebase', name: 'firebase-admin', version: '9.0.0' + implementation group: 'com.google.cloud', name: 'google-cloud-storage', version: '2.17.2' } tasks.named('test') {