diff --git a/app/src/main/java/blisgo/app/BlisgoApplication.java b/app/src/main/java/blisgo/app/BlisgoApplication.java
index 391a893..4da6ee8 100644
--- a/app/src/main/java/blisgo/app/BlisgoApplication.java
+++ b/app/src/main/java/blisgo/app/BlisgoApplication.java
@@ -6,9 +6,11 @@
import blisgo.usecase.UseCaseRoot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.TimeZone;
+@EnableConfigurationProperties
@SpringBootApplication(scanBasePackageClasses = {
InternalRoot.class,
DomainRoot.class,
diff --git a/app/src/main/resources/data.sql b/app/src/main/resources/data.sql
index cbe8cd9..4480215 100644
--- a/app/src/main/resources/data.sql
+++ b/app/src/main/resources/data.sql
@@ -1,50 +1,48 @@
SET @member_id = UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', ''));
-
INSERT INTO reply (post_id, content, member_id)
-VALUES (1, 'This is a test comment 1.', @member_id),
- (1, 'This is a test comment 2.', @member_id),
- (1, 'This is a test comment 3.', @member_id),
- (1, 'This is a test comment 4.', @member_id),
- (1, 'This is a test comment 5.', @member_id),
- (1, 'This is a test comment 6.', @member_id),
- (1, 'This is a test comment 7.', @member_id),
- (1, 'This is a test comment 8.', @member_id),
- (1, 'This is a test comment 9.', @member_id),
- (1, 'This is a test comment 10.', @member_id),
- (1, 'This is a test comment 11.', @member_id),
- (1, 'This is a test comment 12.', @member_id),
- (1, 'This is a test comment 13.', @member_id),
- (1, 'This is a test comment 14.', @member_id),
- (1, 'This is a test comment 15.', @member_id),
- (1, 'This is a test comment 16.', @member_id),
- (1, 'This is a test comment 17.', @member_id),
- (1, 'This is a test comment 18.', @member_id),
- (1, 'This is a test comment 19.', @member_id),
- (1, 'This is a test comment 20.', @member_id),
- (1, 'This is a test comment 21.', @member_id),
- (1, 'This is a test comment 22.', @member_id),
- (1, 'This is a test comment 23.', @member_id),
- (1, 'This is a test comment 24.', @member_id),
- (1, 'This is a test comment 25.', @member_id),
- (1, 'This is a test comment 26.', @member_id),
- (1, 'This is a test comment 27.', @member_id),
- (1, 'This is a test comment 28.', @member_id),
- (1, 'This is a test comment 29.', @member_id),
- (1, 'This is a test comment 30.', @member_id),
- (1, 'This is a test comment 31.', @member_id),
- (1, 'This is a test comment 32.', @member_id),
- (1, 'This is a test comment 33.', @member_id),
- (1, 'This is a test comment 34.', @member_id),
- (1, 'This is a test comment 35.', @member_id),
- (1, 'This is a test comment 36.', @member_id),
- (1, 'This is a test comment 37.', @member_id),
- (1, 'This is a test comment 38.', @member_id),
- (1, 'This is a test comment 39.', @member_id),
- (1, 'This is a test comment 40.', @member_id);
-
+VALUES (1, 'comment 1.', @member_id),
+ (1, 'comment 2.', @member_id),
+ (1, 'comment 3.', @member_id),
+ (1, 'comment 4.', @member_id),
+ (1, 'comment 5.', @member_id),
+ (1, 'comment 6.', @member_id),
+ (1, 'comment 7.', @member_id),
+ (1, 'comment 8.', @member_id),
+ (1, 'comment 9.', @member_id),
+ (1, 'comment 10.', @member_id),
+ (1, 'comment 11.', @member_id),
+ (1, 'comment 12.', @member_id),
+ (1, 'comment 13.', @member_id),
+ (1, 'comment 14.', @member_id),
+ (1, 'comment 15.', @member_id),
+ (1, 'comment 16.', @member_id),
+ (1, 'comment 17.', @member_id),
+ (1, 'comment 18.', @member_id),
+ (1, 'comment 19.', @member_id),
+ (1, 'comment 20.', @member_id),
+ (1, 'comment 21.', @member_id),
+ (1, 'comment 22.', @member_id),
+ (1, 'comment 23.', @member_id),
+ (1, 'comment 24.', @member_id),
+ (1, 'comment 25.', @member_id),
+ (1, 'comment 26.', @member_id),
+ (1, 'comment 27.', @member_id),
+ (1, 'comment 28.', @member_id),
+ (1, 'comment 29.', @member_id),
+ (1, 'comment 30.', @member_id),
+ (1, 'comment 31.', @member_id),
+ (1, 'comment 32.', @member_id),
+ (1, 'comment 33.', @member_id),
+ (1, 'comment 34.', @member_id),
+ (1, 'comment 35.', @member_id),
+ (1, 'comment 36.', @member_id),
+ (1, 'comment 37.', @member_id),
+ (1, 'comment 38.', @member_id),
+ (1, 'comment 39.', @member_id),
+ (1, 'comment 40.', @member_id);
-INSERT INTO post (title, content, member_id)
+INSERT INTO post (title, text, member_id)
VALUES ('Post 1', null, @member_id),
('Post 2', null, @member_id),
('Post 3', null, @member_id),
@@ -147,7 +145,6 @@ VALUES ('IRON', '고철로 배출', 'https://ik.imagekit.io/bli
('PRO_FACILITY', '전문처리시설로 배출', NULL);
-
INSERT INTO waste (waste_id, name, type, picture, treatment)
VALUES (1001, '가격표', '생활폐기물', 'https://ik.imagekit.io/blisgo/dictionary/1001.webp', NULL),
(1002, '가구류', '대형폐기물', 'https://ik.imagekit.io/blisgo/dictionary/1002.webp', NULL),
@@ -885,72 +882,137 @@ VALUES ('PAPER', 1001),
('HOME_APPLIANCES', 1287);
INSERT INTO member (member_id, email, name, picture)
-VALUES (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 'okjaeook98@gmail.com', '옥재욱', 'https://lh3.googleusercontent.com/a/ACg8ocJPZpvBzDi_TG3kMCt_eESIh1-GoXIJW9TyktH0e3NkPwg=s96-c');
+VALUES (@member_id, 'okjaeook98@gmail.com', '옥재욱',
+ 'https://lh3.googleusercontent.com/a/ACg8ocJPZpvBzDi_TG3kMCt_eESIh1-GoXIJW9TyktH0e3NkPwg=s96-c');
SET @time := NOW();
INSERT INTO dogam (member_id, waste_id, created_date)
-VALUES (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1001, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1002, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1003, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1004, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1005, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1006, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1007, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1008, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1009, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1010, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1011, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1012, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1013, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1014, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1015, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1016, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1017, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1018, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1019, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1020, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1021, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1022, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1023, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1024, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1025, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1026, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1027, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1028, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1029, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1030, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1031, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1032, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1033, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1034, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1035, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1036, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1037, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1038, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1039, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1040, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1041, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1042, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1043, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1044, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1045, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1046, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1047, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1048, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1049, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1050, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1051, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1052, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1053, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1054, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1055, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1056, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1057, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1058, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1059, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1060, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1061, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1062, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1063, @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1064, @time := DATE_SUB(@time, INTERVAL 60 SECOND));
\ No newline at end of file
+VALUES (@member_id, 1001,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1002,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1003,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1004,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1005,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1006,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1007,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1008,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1009,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1010,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1011,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1012,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1013,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1014,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1015,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1016,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1017,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1018,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1019,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1020,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1021,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1022,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1023,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1024,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1025,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1026,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1027,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1028,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1029,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1030,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1031,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1032,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1033,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1034,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1035,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1036,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1037,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1038,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1039,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1040,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1041,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1042,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1043,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1044,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1045,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1046,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1047,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1048,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1049,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1050,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1051,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1052,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1053,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1054,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1055,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1056,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1057,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1058,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1059,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1060,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1061,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1062,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1063,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND)),
+ (@member_id, 1064,
+ @time := DATE_SUB(@time, INTERVAL 60 SECOND));
\ No newline at end of file
diff --git a/app/src/main/resources/db/migration/V8__insert_dogam.sql b/app/src/main/resources/db/migration/V8__insert_dogam.sql
index 2dcdbb2..cb37a8c 100644
--- a/app/src/main/resources/db/migration/V8__insert_dogam.sql
+++ b/app/src/main/resources/db/migration/V8__insert_dogam.sql
@@ -1,67 +1,69 @@
SET @time := NOW();
+SET @member_id = UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', ''));
+
INSERT INTO dogam (member_id, waste_id, created_date)
-VALUES (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1001, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1002, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1003, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1004, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1005, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1006, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1007, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1008, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1009, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1010, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1011, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1012, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1013, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1014, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1015, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1016, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1017, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1018, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1019, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1020, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1021, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1022, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1023, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1024, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1025, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1026, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1027, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1028, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1029, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1030, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1031, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1032, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1033, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1034, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1035, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1036, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1037, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1038, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1039, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1040, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1041, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1042, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1043, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1044, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1045, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1046, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1047, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1048, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1049, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1050, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1051, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1052, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1053, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1054, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1055, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1056, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1057, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1058, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1059, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1060, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1061, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1062, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1063, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
- (UNHEX(REPLACE('4c29cb26-d2f3-38d8-9d02-a9da30c7ad99', '-', '')), 1064, @time := DATE_ADD(@time, INTERVAL 1 SECOND));
\ No newline at end of file
+VALUES (@member_id, 1001, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1002, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1003, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1004, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1005, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1006, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1007, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1008, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1009, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1010, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1011, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1012, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1013, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1014, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1015, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1016, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1017, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1018, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1019, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1020, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1021, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1022, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1023, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1024, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1025, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1026, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1027, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1028, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1029, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1030, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1031, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1032, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1033, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1034, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1035, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1036, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1037, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1038, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1039, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1040, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1041, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1042, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1043, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1044, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1045, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1046, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1047, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1048, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1049, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1050, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1051, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1052, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1053, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1054, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1055, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1056, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1057, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1058, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1059, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1060, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1061, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1062, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1063, @time := DATE_ADD(@time, INTERVAL 1 SECOND)),
+ (@member_id, 1064, @time := DATE_ADD(@time, INTERVAL 1 SECOND));
\ No newline at end of file
diff --git a/domain/src/main/java/blisgo/domain/common/Content.java b/domain/src/main/java/blisgo/domain/common/Content.java
index f6949f4..2f12008 100644
--- a/domain/src/main/java/blisgo/domain/common/Content.java
+++ b/domain/src/main/java/blisgo/domain/common/Content.java
@@ -10,10 +10,4 @@ public class Content {
private String text;
private Picture thumbnail;
private String preview;
-
- public static Content of(String text) {
- return Content.builder()
- .text(text)
- .build();
- }
}
diff --git a/domain/src/main/java/blisgo/domain/community/Post.java b/domain/src/main/java/blisgo/domain/community/Post.java
index cca7164..d7a0d9e 100644
--- a/domain/src/main/java/blisgo/domain/community/Post.java
+++ b/domain/src/main/java/blisgo/domain/community/Post.java
@@ -26,25 +26,21 @@ public class Post {
private LocalDateTime createdDate;
private LocalDateTime modifiedDate;
- public static Post create(Long postId, String title, String content) {
+ public static Post create(Long postId, String title, Content content) {
return Post.builder()
.postId(PostId.of(postId))
.title(title)
- .content(Content.of(content))
+ .content(content)
.build();
}
- public static Post create(String title, String content) {
+ public static Post create(String title, Content content) {
return Post.builder()
.title(title)
- .content(Content.of(content))
+ .content(content)
.build();
}
- public void likePost() {
- this.likes++;
- }
-
public boolean isAuthor(String email) {
return this.author.email().equals(email);
}
diff --git a/infrastructure/external/build.gradle b/infrastructure/external/build.gradle
index 2ab9e26..b9e4d6c 100644
--- a/infrastructure/external/build.gradle
+++ b/infrastructure/external/build.gradle
@@ -1,8 +1,6 @@
bootJar.enabled = false
jar.enabled = true
-description = 'redis 를 사용하여 세션관리'
-
dependencies {
implementation project(':usecase')
implementation project(':infrastructure:internal')
@@ -10,4 +8,12 @@ dependencies {
implementation 'org.springframework.session:spring-session-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
+
+ // flyway migration
+ implementation 'org.flywaydb:flyway-core:+'
+ implementation 'org.flywaydb:flyway-mysql:+'
+
+ // file uploader
+ implementation 'com.cloudinary:cloudinary-core:+'
+ implementation 'com.cloudinary:cloudinary-http45:+'
}
\ No newline at end of file
diff --git a/infrastructure/external/src/main/java/blisgo/infrastructure/external/scheduler/ViewCountScheduler.java b/infrastructure/external/src/main/java/blisgo/infrastructure/external/scheduler/ViewCountScheduler.java
index c489ce1..708e59e 100644
--- a/infrastructure/external/src/main/java/blisgo/infrastructure/external/scheduler/ViewCountScheduler.java
+++ b/infrastructure/external/src/main/java/blisgo/infrastructure/external/scheduler/ViewCountScheduler.java
@@ -11,7 +11,7 @@
@Component
@RequiredArgsConstructor
-@Description("캐시에 저장된 조회수를 DB에 업데이트하는 스케줄러")
+@Description("캐시에 저장된 조회수를 DB에 갱신하는 스케줄러")
public class ViewCountScheduler {
private final ViewCountCache viewCountCache;
private final PostMySQLAdapter postMySQLAdapter;
diff --git a/infrastructure/external/src/main/java/blisgo/infrastructure/external/scheduler/WastePopularityScheduler.java b/infrastructure/external/src/main/java/blisgo/infrastructure/external/scheduler/WastePopularityScheduler.java
new file mode 100644
index 0000000..e08dd6a
--- /dev/null
+++ b/infrastructure/external/src/main/java/blisgo/infrastructure/external/scheduler/WastePopularityScheduler.java
@@ -0,0 +1,19 @@
+package blisgo.infrastructure.external.scheduler;
+
+import blisgo.infrastructure.internal.persistence.dictionary.WasteMySQLAdapter;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Description;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+@Description("쓰레기 인기도를 갱신하는 스케줄러")
+public class WastePopularityScheduler {
+ private final WasteMySQLAdapter wasteMySQLAdapter;
+
+ @Scheduled(zone = "UTC", cron = "0 0 0 * * *")
+ public void updateWastePopularity() {
+ wasteMySQLAdapter.updateWastePopularity();
+ }
+}
diff --git a/infrastructure/external/src/main/java/blisgo/infrastructure/external/uploader/CloudinaryClient.java b/infrastructure/external/src/main/java/blisgo/infrastructure/external/uploader/CloudinaryClient.java
new file mode 100644
index 0000000..2ea25e1
--- /dev/null
+++ b/infrastructure/external/src/main/java/blisgo/infrastructure/external/uploader/CloudinaryClient.java
@@ -0,0 +1,88 @@
+package blisgo.infrastructure.external.uploader;
+
+import blisgo.usecase.port.infra.FileUploadOutputPort;
+import com.cloudinary.Cloudinary;
+import com.cloudinary.Transformation;
+import jakarta.annotation.PostConstruct;
+import lombok.RequiredArgsConstructor;
+import org.jmolecules.architecture.hexagonal.SecondaryAdapter;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.Resource;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+
+@SecondaryAdapter
+@Component
+@RequiredArgsConstructor
+public class CloudinaryClient implements FileUploadOutputPort {
+ private Cloudinary cloudinary;
+
+ @Value("${cloudinary.cloud-name}")
+ private String cloudName;
+
+ @Value("${cloudinary.api-key}")
+ private String apiKey;
+
+ @Value("${cloudinary.api-secret}")
+ private String apiSecret;
+
+ @PostConstruct
+ private void init() {
+ cloudinary = new Cloudinary(Map.ofEntries(
+ Map.entry("cloud_name", cloudName),
+ Map.entry("api_key", apiKey),
+ Map.entry("api_secret", apiSecret)
+ ));
+ }
+
+ @Override
+ public URI uploadFile(Resource resource) {
+ var transformation = new Transformation()
+ .quality("auto")
+ .crop("scale")
+ .fetchFormat("webp");
+
+ String originalFilename = resource.getFilename();
+ String extension = Objects.requireNonNull(originalFilename)
+ .substring(originalFilename.lastIndexOf(".") + 1);
+ String newFilename = UUID.randomUUID() + "." + extension;
+ Path tmpPath = Paths.get(newFilename);
+
+ var map = Map.ofEntries(
+ Map.entry("folder", "board"),
+ Map.entry("resource_type", "auto"),
+ Map.entry("format", extension),
+ Map.entry("transformation", transformation)
+ );
+
+ try {
+ Files.copy(resource.getInputStream(), tmpPath, StandardCopyOption.REPLACE_EXISTING);
+ File tmpFile = tmpPath.toFile();
+ var result = cloudinary.uploader().upload(tmpFile, map);
+ var option = "q_auto,f_webp/";
+ var location = addOpt((String) Objects.requireNonNull(result).get("secure_url"), option);
+ Files.deleteIfExists(tmpPath);
+ return URI.create(location);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String addOpt(String str, String opt) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(str);
+ int appendIndex = sb.indexOf("/v") + 1;
+ sb.insert(appendIndex, opt);
+ return sb.toString();
+ }
+}
diff --git a/infrastructure/internal/build.gradle b/infrastructure/internal/build.gradle
index 7262ab6..013dc12 100644
--- a/infrastructure/internal/build.gradle
+++ b/infrastructure/internal/build.gradle
@@ -3,13 +3,11 @@ plugins {
id 'io.swagger.swaggerhub' version '+'
}
-ext {
- springCloudVersion = "2023.0.1"
-}
-
bootJar.enabled = false
jar.enabled = true
+description = 'infra 내부요소로 spring framework과 직결되는 자원을 이곳에 위치시킨다'
+
dependencies {
implementation project(':domain')
implementation project(':usecase')
@@ -50,10 +48,6 @@ dependencies {
implementation 'org.thymeleaf.extras:thymeleaf-extras-java8time:+'
implementation 'org.springframework.boot:spring-boot-starter-web'
-
- // flyway
- implementation 'org.flywaydb:flyway-core:+'
- implementation 'org.flywaydb:flyway-mysql:+'
}
def querydslDir = "${project.projectDir}/build/generated/querydsl"
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaContent.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaContent.java
index a39ce96..209ef7c 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaContent.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaContent.java
@@ -1,15 +1,29 @@
package blisgo.infrastructure.internal.persistence.common;
-import lombok.*;
+import jakarta.persistence.AttributeOverride;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Embedded;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import org.hibernate.annotations.Comment;
+@Embeddable
@Builder
@Getter
-@AllArgsConstructor(staticName = "of")
-@NoArgsConstructor(access = AccessLevel.PROTECTED)
+@AllArgsConstructor
+@NoArgsConstructor
public class JpaContent {
+ @Comment("글 내용")
+ @Column(columnDefinition = "JSON")
private String text;
+ @Embedded
+ @AttributeOverride(name = "url", column = @Column(name = "picture"))
private JpaPicture thumbnail;
+ @Comment("글 미리보기")
private String preview;
}
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaPicture.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaPicture.java
index 1513ce5..d9cbe2e 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaPicture.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/common/JpaPicture.java
@@ -1,6 +1,7 @@
package blisgo.infrastructure.internal.persistence.common;
import jakarta.persistence.Embeddable;
+import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -9,8 +10,8 @@
@Getter
@Embeddable
-@AllArgsConstructor(staticName = "of")
-@NoArgsConstructor
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class JpaPicture {
@URL(protocol = "https")
@Comment("이미지")
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/PostMySQLAdapter.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/PostMySQLAdapter.java
index 222b456..07cb5c2 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/PostMySQLAdapter.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/PostMySQLAdapter.java
@@ -5,7 +5,7 @@
import blisgo.infrastructure.internal.persistence.community.model.JpaPost;
import blisgo.infrastructure.internal.persistence.community.repository.PostCustomRepository;
import blisgo.infrastructure.internal.persistence.community.repository.PostJpaRepository;
-import blisgo.usecase.port.PostOutputPort;
+import blisgo.usecase.port.domain.PostOutputPort;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/ReplyMySQLAdapter.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/ReplyMySQLAdapter.java
index 5f600b6..05f63c0 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/ReplyMySQLAdapter.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/ReplyMySQLAdapter.java
@@ -4,7 +4,7 @@
import blisgo.infrastructure.internal.persistence.community.mapper.ReplyMapper;
import blisgo.infrastructure.internal.persistence.community.repository.ReplyCustomRepository;
import blisgo.infrastructure.internal.persistence.community.repository.ReplyJpaRepository;
-import blisgo.usecase.port.ReplyOutputPort;
+import blisgo.usecase.port.domain.ReplyOutputPort;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
@@ -35,16 +35,4 @@ public Slice read(Long postId, Pageable pageable, Long lastReplyId) {
return customRepository.find(pageable, postId, lastReplyId)
.map(mapper::toDomain);
}
-
- @Override
- public boolean update(Reply domain) {
- var jpaReply = mapper.toEntity(domain);
-
- jpaRepository.findById(jpaReply.replyId()).ifPresentOrElse(
- existingReply -> existingReply.updateInfo(jpaReply),
- () -> jpaRepository.save(jpaReply)
- );
-
- return true;
- }
}
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaPost.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaPost.java
index 84ee3af..730bff1 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaPost.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaPost.java
@@ -1,6 +1,5 @@
package blisgo.infrastructure.internal.persistence.community.model;
-import blisgo.infrastructure.internal.persistence.base.ContentConverter;
import blisgo.infrastructure.internal.persistence.common.BaseEntity;
import blisgo.infrastructure.internal.persistence.common.JpaContent;
import jakarta.persistence.*;
@@ -29,9 +28,7 @@ public class JpaPost extends BaseEntity {
@Comment("제목")
private String title;
- @Comment("내용")
- @Column(name = "content", columnDefinition = "JSON")
- @Convert(converter = ContentConverter.class)
+ @Embedded
private JpaContent content;
@ColumnDefault("0")
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaReply.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaReply.java
index c07c346..1aa5dd7 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaReply.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/model/JpaReply.java
@@ -29,8 +29,4 @@ public class JpaReply extends BaseEntity {
@Lob
@Comment("내용")
private String content;
-
- public void updateInfo(JpaReply jpaReply) {
- this.content = jpaReply.content;
- }
}
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/repository/PostCustomRepository.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/repository/PostCustomRepository.java
index d90f206..afa64ea 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/repository/PostCustomRepository.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/community/repository/PostCustomRepository.java
@@ -2,6 +2,7 @@
import blisgo.infrastructure.internal.persistence.base.NoOffsetSliceHelper;
import blisgo.infrastructure.internal.persistence.common.JpaAuthor;
+import blisgo.infrastructure.internal.persistence.common.JpaContent;
import blisgo.infrastructure.internal.persistence.community.model.JpaPost;
import com.querydsl.core.types.Projections;
import com.querydsl.jpa.impl.JPAQueryFactory;
@@ -9,7 +10,6 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.SliceImpl;
-import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -23,20 +23,24 @@
@RequiredArgsConstructor
public class PostCustomRepository {
private final JPAQueryFactory jpaQueryFactory;
- private final JdbcTemplate jdbcTemplate;
public Slice find(Pageable pageable, long lastPostId) {
- var joinMember = Projections.fields(JpaAuthor.class,
+ var memberField = Projections.fields(JpaAuthor.class,
jpaMember.email,
jpaMember.name,
jpaMember.picture.as("picture")
);
+ var contentField = Projections.fields(JpaContent.class,
+ jpaPost.content.thumbnail,
+ jpaPost.content.preview
+ );
+
var fields = Projections.fields(JpaPost.class,
jpaPost.postId,
jpaPost.title,
- jpaPost.content,
- joinMember.as("author"),
+ contentField.as("content"),
+ memberField.as("author"),
jpaPost.views,
jpaPost.likes,
jpaPost.modifiedDate,
@@ -85,17 +89,21 @@ public boolean updateLike(Long postId, Boolean isLike) {
}
public Optional findByIdWithReplies(Long postId) {
- var joinMember = Projections.fields(JpaAuthor.class,
+ var memberField = Projections.fields(JpaAuthor.class,
jpaMember.email,
jpaMember.name,
jpaMember.picture.as("picture")
);
+ var contentField = Projections.fields(JpaContent.class,
+ jpaPost.content.text
+ );
+
var fields = Projections.fields(JpaPost.class,
jpaPost.postId,
jpaPost.title,
- jpaPost.content,
- joinMember.as("author"),
+ contentField.as("content"),
+ memberField.as("author"),
jpaPost.views,
jpaPost.likes,
jpaPost.modifiedDate,
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/DogamMySQLAdapter.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/DogamMySQLAdapter.java
index 773b7d5..4b748b3 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/DogamMySQLAdapter.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/DogamMySQLAdapter.java
@@ -9,7 +9,7 @@
import blisgo.infrastructure.internal.persistence.dictionary.model.JpaDogamId;
import blisgo.infrastructure.internal.persistence.dictionary.repository.DogamCustomRepository;
import blisgo.infrastructure.internal.persistence.dictionary.repository.DogamJpaRepository;
-import blisgo.usecase.port.DogamOutputPort;
+import blisgo.usecase.port.domain.DogamOutputPort;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/WasteMySQLAdapter.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/WasteMySQLAdapter.java
index 992706d..4c98867 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/WasteMySQLAdapter.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/dictionary/WasteMySQLAdapter.java
@@ -8,7 +8,7 @@
import blisgo.infrastructure.internal.persistence.dictionary.repository.GuideJpaRepository;
import blisgo.infrastructure.internal.persistence.dictionary.repository.WasteCustomRepository;
import blisgo.infrastructure.internal.persistence.dictionary.repository.WasteJpaRepository;
-import blisgo.usecase.port.WasteOutputPort;
+import blisgo.usecase.port.domain.WasteOutputPort;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/member/MemberMySQLAdapter.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/member/MemberMySQLAdapter.java
index c430deb..0f18359 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/member/MemberMySQLAdapter.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/member/MemberMySQLAdapter.java
@@ -4,7 +4,7 @@
import blisgo.infrastructure.internal.persistence.member.mapper.MemberMapper;
import blisgo.infrastructure.internal.persistence.member.repository.MemberCustomRepository;
import blisgo.infrastructure.internal.persistence.member.repository.MemberJpaRepository;
-import blisgo.usecase.port.MemberOutputPort;
+import blisgo.usecase.port.domain.MemberOutputPort;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/security/CustomOidcUserService.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/security/CustomOidcUserService.java
index f5f0d70..c61ffbe 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/security/CustomOidcUserService.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/security/CustomOidcUserService.java
@@ -1,7 +1,7 @@
package blisgo.infrastructure.internal.security;
import blisgo.domain.member.Member;
-import blisgo.usecase.port.MemberInputPort;
+import blisgo.usecase.port.domain.MemberInputPort;
import blisgo.usecase.request.member.GetMember;
import blisgo.usecase.request.member.UpdateMember;
import lombok.RequiredArgsConstructor;
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/base/ContentConverter.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/base/ContentParser.java
similarity index 56%
rename from infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/base/ContentConverter.java
rename to infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/base/ContentParser.java
index 29cc850..93fdf59 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/persistence/base/ContentConverter.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/base/ContentParser.java
@@ -1,15 +1,14 @@
-package blisgo.infrastructure.internal.persistence.base;
+package blisgo.infrastructure.internal.ui.base;
-import blisgo.infrastructure.internal.persistence.common.JpaPicture;
-import blisgo.infrastructure.internal.persistence.common.JpaContent;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import jakarta.persistence.AttributeConverter;
-import jakarta.persistence.Converter;
+import lombok.experimental.UtilityClass;
-@Converter(autoApply = true)
-public class ContentConverter implements AttributeConverter {
+import java.util.Optional;
+
+@UtilityClass
+public class ContentParser {
private final ObjectMapper objectMapper = new ObjectMapper();
private static final String TYPE = "type";
@@ -19,32 +18,23 @@ public class ContentConverter implements AttributeConverter
private static final String URL = "url";
private static final String IMAGE = "image";
private static final String PARAGRAPH = "paragraph";
+ private static final String FILE = "file";
- @Override
- public String convertToDatabaseColumn(JpaContent content) {
- return content.text();
- }
-
- @Override
- public JpaContent convertToEntityAttribute(String dbData) {
+ public static JsonNode toJson(String content) {
JsonNode json;
- String thumbnail, preview;
- dbData = dbData == null ? "" : dbData;
+ String text = Optional.ofNullable(content).orElse("");
try {
- json = objectMapper.readTree(dbData);
+ json = objectMapper.readTree(text);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
- thumbnail = parseFirstImageUrl(json);
- preview = parseFirstParagraph(json);
-
- return JpaContent.of(dbData, JpaPicture.of(thumbnail), preview);
+ return json;
}
- private String parseFirstParagraph(JsonNode json) {
+ public static String parseFirstParagraph(JsonNode json) {
JsonNode blocksNode = json.get(BLOCKS);
if (blocksNode == null) {
@@ -60,7 +50,7 @@ private String parseFirstParagraph(JsonNode json) {
return null;
}
- private String parseFirstImageUrl(JsonNode json) {
+ public static String parseFirstImageUrl(JsonNode json) {
JsonNode blocksNode = json.get(BLOCKS);
if (blocksNode == null) {
@@ -69,7 +59,7 @@ private String parseFirstImageUrl(JsonNode json) {
for (JsonNode blockNode : blocksNode) {
if (IMAGE.equals(blockNode.get(TYPE).asText())) {
- return blockNode.get(DATA).get(URL).asText();
+ return blockNode.get(DATA).get(FILE).get(URL).asText();
}
}
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/DogamRender.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/DogamRender.java
index 951fa49..abc0b2b 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/DogamRender.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/DogamRender.java
@@ -81,22 +81,4 @@ public ModelAndView dogams(
Map.of("dogams", dogams.map(wasteMapper::toDTO))
);
}
-
- @GetMapping("/{wasteId}")
- @ResponseStatus(HttpStatus.OK)
- public boolean dogam(
- @AuthenticationPrincipal DefaultOidcUser oidcUser,
- @PathVariable Long wasteId
- ) {
- if (oidcUser == null) {
- return false;
- }
-
- var query = GetDogam.builder()
- .email(oidcUser.getEmail())
- .wasteId(wasteId)
- .build();
-
- return dogamQuery.checkThatWasteRegisteredFromDogam(query);
- }
}
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java
index 1a63017..2f83d39 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/PostRender.java
@@ -1,6 +1,7 @@
package blisgo.infrastructure.internal.ui.render;
import blisgo.infrastructure.internal.persistence.community.mapper.PostMapper;
+import blisgo.infrastructure.internal.ui.base.ContentParser;
import blisgo.infrastructure.internal.ui.base.Router;
import blisgo.usecase.request.post.*;
import lombok.RequiredArgsConstructor;
@@ -54,8 +55,7 @@ public ModelAndView post(@PathVariable Long postId) {
return new ModelAndView(
routes(Folder.COMMUNITY, Page.CONTENT) + fragment(Fragment.POST),
Map.ofEntries(
- Map.entry("post", mapper.toDTO(post)),
- Map.entry("readOnly", true)
+ Map.entry("post", mapper.toDTO(post))
)
);
}
@@ -63,6 +63,15 @@ public ModelAndView post(@PathVariable Long postId) {
@PostMapping
@PreAuthorize("isAuthenticated()")
public RedirectView addPost(AddPost command) {
+ var json = ContentParser.toJson(command.content());
+ String thumbnail = ContentParser.parseFirstImageUrl(json);
+ String preview = ContentParser.parseFirstParagraph(json);
+
+ command = command.toBuilder()
+ .thumbnail(thumbnail)
+ .preview(preview)
+ .build();
+
commandUsecase.addPost(command);
return new RedirectView(routes(Folder.COMMUNITY), false);
@@ -71,6 +80,15 @@ public RedirectView addPost(AddPost command) {
@PatchMapping("/{postId}")
@PreAuthorize("isAuthenticated()")
public RedirectView updatePost(UpdatePost command) {
+ var json = ContentParser.toJson(command.content());
+ String thumbnail = ContentParser.parseFirstImageUrl(json);
+ String preview = ContentParser.parseFirstParagraph(json);
+
+ command = command.toBuilder()
+ .thumbnail(thumbnail)
+ .preview(preview)
+ .build();
+
commandUsecase.updatePost(command);
return new RedirectView(routes(Folder.COMMUNITY, command.postId()), true);
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/WasteRender.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/WasteRender.java
index fe4f95c..c39f740 100644
--- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/WasteRender.java
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/render/WasteRender.java
@@ -3,13 +3,18 @@
import blisgo.infrastructure.internal.persistence.dictionary.mapper.GuideMapper;
import blisgo.infrastructure.internal.persistence.dictionary.mapper.WasteMapper;
import blisgo.infrastructure.internal.ui.base.Router;
+import blisgo.usecase.request.dogam.DogamQuery;
+import blisgo.usecase.request.dogam.GetDogam;
import blisgo.usecase.request.waste.GetWaste;
import blisgo.usecase.request.waste.WasteQuery;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+import org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@@ -25,8 +30,9 @@ public class WasteRender extends Router {
private final WasteQuery queryUsecase;
private final WasteMapper wasteMapper;
private final GuideMapper guideMapper;
+ private final DogamQuery dogamQueryUsecase;
- @GetMapping
+/* @GetMapping
public ModelAndView wastes(
@PageableDefault(size = 24, sort = "wasteId", direction = ASC) Pageable pageable,
@RequestParam(required = false, defaultValue = "0") Long lastWasteId,
@@ -62,5 +68,54 @@ public ModelAndView wastes(
)
);
}
+ }*/
+
+ @GetMapping
+ public ModelAndView getWastes(
+ @PageableDefault(size = 24, sort = "wasteId", direction = ASC) Pageable pageable,
+ @RequestParam(required = false, defaultValue = "0") Long lastWasteId
+ ) {
+ var query = GetWaste.builder()
+ .pageable(pageable)
+ .lastWasteId(lastWasteId)
+ .build();
+
+ var wastes = queryUsecase.getWastes(query);
+
+ return new ModelAndView(
+ routes(Folder.DICTIONARY, Page.CATALOGUE) + fragment(Fragment.WASTES),
+ Map.of("wastes", wastes.map(wasteMapper::toDTO))
+ );
+ }
+
+ @GetMapping("/{wasteId}")
+ public ModelAndView getWaste(
+ @PathVariable Long wasteId,
+ @AuthenticationPrincipal DefaultOidcUser oidcUser
+ ) {
+ var query = GetWaste.builder()
+ .wasteId(wasteId)
+ .build();
+
+ var waste = queryUsecase.getWaste(query);
+ var guides = queryUsecase.getGuides(waste.categories());
+ var relatedWastes = queryUsecase.getWastesRelated(waste.categories());
+
+ var dogamQuery = GetDogam.builder()
+ .email(oidcUser.getEmail())
+ .wasteId(wasteId)
+ .build();
+
+ var dogamExists = dogamQueryUsecase.checkThatWasteRegisteredFromDogam(dogamQuery);
+
+ return new ModelAndView(
+ routes(Folder.DICTIONARY, Page.INFO) + fragment(Fragment.WASTE),
+ Map.ofEntries(
+ Map.entry("waste", wasteMapper.toDTO(waste)),
+ Map.entry("guides", guideMapper.toDTOs(guides)),
+ Map.entry("relatedWastes", wasteMapper.toDTOs(relatedWastes)),
+ Map.entry("dogamExists", dogamExists)
+ )
+ );
}
}
diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/CloudStorageUploader.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/CloudStorageUploader.java
new file mode 100644
index 0000000..a56bccc
--- /dev/null
+++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/CloudStorageUploader.java
@@ -0,0 +1,34 @@
+package blisgo.infrastructure.internal.ui.rest;
+
+import blisgo.usecase.port.infra.FileUploadInputPort;
+import lombok.RequiredArgsConstructor;
+import org.springframework.core.io.Resource;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.net.URI;
+import java.util.Map;
+
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/api/cloud")
+public class CloudStorageUploader {
+ private final FileUploadInputPort port;
+
+ @PostMapping("/upload/file")
+ public ResponseEntity