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> upload(MultipartFile file) { + Resource resource = file.getResource(); + + URI fileEndpoint = port.upload(resource); + + var response = Map.ofEntries( + Map.entry("success", 1), + Map.entry("file", Map.of("url", fileEndpoint.toString())) + ); + + return ResponseEntity.ok(response); + } +} diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/rest/JacksonConfig.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/JacksonConfig.java similarity index 94% rename from infrastructure/internal/src/main/java/blisgo/infrastructure/internal/rest/JacksonConfig.java rename to infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/JacksonConfig.java index a070064..5135c15 100644 --- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/rest/JacksonConfig.java +++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/JacksonConfig.java @@ -1,4 +1,4 @@ -package blisgo.infrastructure.internal.rest; +package blisgo.infrastructure.internal.ui.rest; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.PropertyNamingStrategies; diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/rest/Uploadable.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/Uploadable.java similarity index 87% rename from infrastructure/internal/src/main/java/blisgo/infrastructure/internal/rest/Uploadable.java rename to infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/Uploadable.java index 31a3923..88fd776 100644 --- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/rest/Uploadable.java +++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/rest/Uploadable.java @@ -1,4 +1,4 @@ -package blisgo.infrastructure.internal.rest; +package blisgo.infrastructure.internal.ui.rest; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java index 6c0a7cf..94b1d32 100644 --- a/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java +++ b/infrastructure/internal/src/main/java/blisgo/infrastructure/internal/ui/view/CommunityView.java @@ -35,8 +35,7 @@ public ModelAndView content(@PathVariable Long postId) { return new ModelAndView( routes(Folder.COMMUNITY, Page.CONTENT), Map.ofEntries( - Map.entry("postId", postId), - Map.entry("readOnly", false) + Map.entry("postId", postId) ) ); } @@ -57,7 +56,6 @@ public ModelAndView write( if (post != null && post.isAuthor(oidcUser.getEmail())) { model.addAttribute("post", mapper.toDTO(post)); - model.addAttribute("readOnly", false); } } diff --git a/infrastructure/internal/src/main/resources/application-common.yml b/infrastructure/internal/src/main/resources/application-common.yml index c7321a7..b040e8f 100644 --- a/infrastructure/internal/src/main/resources/application-common.yml +++ b/infrastructure/internal/src/main/resources/application-common.yml @@ -1,6 +1,11 @@ unsplash: - host: 'api.unsplash.com' - path: '/photos/random' - query: 'waste,garbage,trash,recycling' - options: '&fm=webp&w=1500&q=50&blur=50' - client-id: 'CTW7rq3n5wwaqHphLTlv47RsPHweBqy4QWe7_YVCvk8' + host: ${UNSPLASH_HOST} + path: ${UNSPLASH_PATH} + query: ${UNSPLASH_QUERY} + options: ${UNSPLASH_OPTIONS} + client-id: ${UNSPLASH_CLIENT_ID} + +cloudinary: + cloud-name: ${CLOUDINARY_CLOUD_NAME} + api-key: ${CLOUDINARY_API_KEY} + api-secret: ${CLOUDINARY_API_SECRET} \ No newline at end of file diff --git a/infrastructure/internal/src/main/resources/static/assets/js/cmmn/editor.js b/infrastructure/internal/src/main/resources/static/assets/js/cmmn/editor.js new file mode 100644 index 0000000..11825e1 --- /dev/null +++ b/infrastructure/internal/src/main/resources/static/assets/js/cmmn/editor.js @@ -0,0 +1,215 @@ +var editor = new EditorJS({ + holder: 'editorjs', + + readOnly: readOnly, + + tools: { + checklist: { + class: Checklist, + inlineToolbar: true, + }, + code: { + class: CodeTool, + shortcut: 'CMD+SHIFT+D' + }, + delimiter: Delimiter, + embed: Embed, + header: { + class: Header, + inlineToolbar: ['link'], + config: { + placeholder: 'Header' + }, + shortcut: 'CMD+SHIFT+H' + }, + image: { + class: ImageTool, + config: { + field: 'file', + endpoints: { + byFile: '/api/cloud/upload/file', + byUrl: '/api/cloud/upload/url' + } + } + }, + attaches: { + class: AttachesTool, + config: { + field: 'file', + endpoint: '/api/cloud/upload/file', + errorMessage: "자원이 업로드되지 않습니다" + } + }, + inlineCode: { + class: InlineCode, + shortcut: 'CMD+SHIFT+M' + }, + linkTool: LinkTool, + list: { + class: List, + inlineToolbar: true, + }, + marker: { + class: Marker, + shortcut: 'CMD+SHIFT+M' + }, + quote: { + class: Quote, + inlineToolbar: true, + }, + raw: RawTool, + table: { + class: Table, + inlineToolbar: true, + }, + warning: Warning, + // ... + }, + + /** + * Previously saved data that should be rendered + */ + onReady: function () { + var loadedData = JSON.parse(content); + if (loadedData != null) { + editor.clear(); + editor.render(loadedData); + } + }, + onChange: function (api, event) { }, + + rendered: function () { }, + + i18n: { + /** + * @type {I18nDictionary} + */ + messages: { + ui: { + "blockTunes": { + "toggler": { + "Click to tune": "옵션 확장", + "or drag to move": "또는 드래그하여 이동" + }, + }, + "inlineToolbar": { + "converter": { + "Convert to": "변환하기" + } + }, + "toolbar": { + "toolbox": { + "Add": "추가" + } + }, + "popover": { + "Filter": "필터", + "Nothing found": "찾을 수 없습니다", + } + }, + + toolNames: { + "Text": "텍스트", + "Heading": "제목", + "List": "리스트", + "Warning": "경고", + "Checklist": "체크리스트", + "Quote": "인용문", + "Code": "코드", + "Delimiter": "구분선", + "Raw HTML": "HTML", + "Table": "테이블", + "Link": "링크", + "Marker": "마커", + "Bold": "굵게", + "Italic": "기울임", + "InlineCode": "인라인 코드", + "Image": "이미지", + "Attachment": "첨부" + }, + + tools: { + "warning": { + "Title": "제목", + "Message": "메시지", + }, + + "link": { + "Add a link": "링크 추가", + }, + + "stub": { + 'The block can not be displayed correctly.': '블록을 올바르게 표시할 수 없습니다.' + }, + "image": { + "Caption": "캡션", + "Select an Image": "이미지 선택", + "With border": "테두리 추가", + "Stretch image": "이미지 확장", + "With background": "배경 추가", + }, + "code": { + "Enter a code": "코드를 입력하세요", + }, + "linkTool": { + "Link": "링크", + "Couldn't fetch the link data": "링크 데이터를 가져올 수 없습니다", + "Couldn't get this link data, try the other one": "이 링크 데이터를 가져올 수 없습니다. 다른 링크를 시도하세요", + "Wrong response format from the server": "서버로부터 잘못된 응답 형식", + }, + "header": { + "Header": "헤딩", + }, + "paragraph": { + "Enter something": "내용을 입력하세요", + }, + "list": { + "Ordered": "번호", + "Unordered": "글머리", + }, + "quote": { + "Enter a quote": "인용절 입력", + "Enter a caption": "캡션 입력", + }, + "attachment": { + "File upload failed": "파일을 올리지 못했습니다", + "Select file to upload": "파일을 선택하여 업로드", + }, + "table": { + "With headings": "헤딩 추가", + "Without headings": "헤딩 삭제", + } + }, + + blockTunes: { + "delete": { + "Delete": "삭제", + "Click to delete": "클릭하여 삭제", + }, + "moveUp": { + "Move up": "위로 이동" + }, + "moveDown": { + "Move down": "아래로 이동" + } + }, + } + }, +}); + +var saveButton = document.getElementById('save-button'); + +if (saveButton != null) { + saveButton.addEventListener('click', function () { + editor.save() + .then((savedData) => { + document.getElementById('editorjs-content').value = JSON.stringify(savedData, null, 0); + var form = document.getElementById('form'); + form.method = "post"; + form.submit(); + }) + .catch((error) => { + console.error('Saving error', error); + }); + }); +} \ No newline at end of file diff --git a/infrastructure/internal/src/main/resources/templates/community/board.html b/infrastructure/internal/src/main/resources/templates/community/board.html index 1ae7694..c5bcbcc 100644 --- a/infrastructure/internal/src/main/resources/templates/community/board.html +++ b/infrastructure/internal/src/main/resources/templates/community/board.html @@ -117,6 +117,6 @@

제목

-

글내용

프로필이미지작성자작성일좋아요댓글
+

글내용

프로필이미지작성자작성일좋아요댓글
\ No newline at end of file diff --git a/infrastructure/internal/src/main/resources/templates/community/content.html b/infrastructure/internal/src/main/resources/templates/community/content.html index b033215..4836109 100644 --- a/infrastructure/internal/src/main/resources/templates/community/content.html +++ b/infrastructure/internal/src/main/resources/templates/community/content.html @@ -114,14 +114,14 @@
-
+
닉네임 - 작성일조회수좋아요
\ No newline at end of file + /**/ + +
\ No newline at end of file diff --git a/infrastructure/internal/src/main/resources/templates/community/write.html b/infrastructure/internal/src/main/resources/templates/community/write.html index cbb2fc3..934713b 100644 --- a/infrastructure/internal/src/main/resources/templates/community/write.html +++ b/infrastructure/internal/src/main/resources/templates/community/write.html @@ -109,8 +109,8 @@ -
-
+
+
@@ -126,135 +126,16 @@ + var readOnly = false; + /*]]>*/ + +
diff --git a/infrastructure/internal/src/main/resources/templates/dictionary/info.html b/infrastructure/internal/src/main/resources/templates/dictionary/info.html index 77a5992..1e46663 100644 --- a/infrastructure/internal/src/main/resources/templates/dictionary/info.html +++ b/infrastructure/internal/src/main/resources/templates/dictionary/info.html @@ -123,7 +123,7 @@ -
@@ -175,7 +175,7 @@

연관된 폐기물

-
+
diff --git a/usecase/src/main/java/blisgo/usecase/port/DogamInputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/DogamInputPort.java similarity index 97% rename from usecase/src/main/java/blisgo/usecase/port/DogamInputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/DogamInputPort.java index 2d9968a..ae90381 100644 --- a/usecase/src/main/java/blisgo/usecase/port/DogamInputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/DogamInputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.dictionary.Dogam; import blisgo.domain.dictionary.vo.DogamId; diff --git a/usecase/src/main/java/blisgo/usecase/port/DogamOutputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/DogamOutputPort.java similarity index 92% rename from usecase/src/main/java/blisgo/usecase/port/DogamOutputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/DogamOutputPort.java index 5e98704..689af78 100644 --- a/usecase/src/main/java/blisgo/usecase/port/DogamOutputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/DogamOutputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.dictionary.Dogam; import blisgo.domain.dictionary.vo.DogamId; diff --git a/usecase/src/main/java/blisgo/usecase/port/MemberInputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/MemberInputPort.java similarity index 97% rename from usecase/src/main/java/blisgo/usecase/port/MemberInputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/MemberInputPort.java index 9bfa2e3..f478426 100644 --- a/usecase/src/main/java/blisgo/usecase/port/MemberInputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/MemberInputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.member.Member; import blisgo.usecase.request.member.*; diff --git a/usecase/src/main/java/blisgo/usecase/port/MemberOutputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/MemberOutputPort.java similarity index 89% rename from usecase/src/main/java/blisgo/usecase/port/MemberOutputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/MemberOutputPort.java index d4ed270..b8a031e 100644 --- a/usecase/src/main/java/blisgo/usecase/port/MemberOutputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/MemberOutputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.member.Member; import org.jmolecules.architecture.hexagonal.SecondaryPort; diff --git a/usecase/src/main/java/blisgo/usecase/port/PostInputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/PostInputPort.java similarity index 75% rename from usecase/src/main/java/blisgo/usecase/port/PostInputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/PostInputPort.java index dc3e961..5f9b6b6 100644 --- a/usecase/src/main/java/blisgo/usecase/port/PostInputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/PostInputPort.java @@ -1,5 +1,7 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; +import blisgo.domain.common.Content; +import blisgo.domain.common.Picture; import blisgo.domain.community.Post; import blisgo.usecase.base.Events; import blisgo.usecase.event.PostViewedEvent; @@ -19,9 +21,15 @@ public class PostInputPort implements PostCommand, PostQuery { @Override public boolean addPost(AddPost command) { + Content content = Content.of( + command.content(), + Picture.of(command.thumbnail()), + command.preview() + ); + var post = Post.create( command.title(), - command.content() + content ); return port.create(post); @@ -29,10 +37,16 @@ public boolean addPost(AddPost command) { @Override public boolean updatePost(UpdatePost command) { + Content content = Content.of( + command.content(), + Picture.of(command.thumbnail()), + command.preview() + ); + var post = Post.create( command.postId(), command.title(), - command.content() + content ); return port.update(post); diff --git a/usecase/src/main/java/blisgo/usecase/port/PostOutputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/PostOutputPort.java similarity index 90% rename from usecase/src/main/java/blisgo/usecase/port/PostOutputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/PostOutputPort.java index 76bbab1..0d8684e 100644 --- a/usecase/src/main/java/blisgo/usecase/port/PostOutputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/PostOutputPort.java @@ -1,10 +1,11 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.community.Post; import org.jmolecules.architecture.hexagonal.SecondaryPort; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; +import java.io.File; import java.util.List; import java.util.Map; diff --git a/usecase/src/main/java/blisgo/usecase/port/ReplyInputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/ReplyInputPort.java similarity index 96% rename from usecase/src/main/java/blisgo/usecase/port/ReplyInputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/ReplyInputPort.java index fe96ab9..7803e16 100644 --- a/usecase/src/main/java/blisgo/usecase/port/ReplyInputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/ReplyInputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.community.Reply; import blisgo.domain.community.vo.PostId; diff --git a/usecase/src/main/java/blisgo/usecase/port/ReplyOutputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/ReplyOutputPort.java similarity index 85% rename from usecase/src/main/java/blisgo/usecase/port/ReplyOutputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/ReplyOutputPort.java index 0fbcb29..271a6bf 100644 --- a/usecase/src/main/java/blisgo/usecase/port/ReplyOutputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/ReplyOutputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.community.Reply; import org.jmolecules.architecture.hexagonal.SecondaryPort; @@ -12,6 +12,4 @@ public interface ReplyOutputPort { boolean create(Reply domain); Slice read(Long postId, Pageable pageable, Long lastReplyId); - - boolean update(Reply domain); } diff --git a/usecase/src/main/java/blisgo/usecase/port/WasteInputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/WasteInputPort.java similarity index 88% rename from usecase/src/main/java/blisgo/usecase/port/WasteInputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/WasteInputPort.java index e2546de..58e9c39 100644 --- a/usecase/src/main/java/blisgo/usecase/port/WasteInputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/WasteInputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.dictionary.Waste; import blisgo.domain.dictionary.vo.Category; @@ -44,4 +44,9 @@ public Slice getWastesFromDogam(GetDogam query) { public List getWastesRelated(List categories) { return port.readWastesRelated(categories); } + + @Override + public List getWastesRelated(GetWaste query) { + return port.readWastesRelated(query.categories()); + } } diff --git a/usecase/src/main/java/blisgo/usecase/port/WasteOutputPort.java b/usecase/src/main/java/blisgo/usecase/port/domain/WasteOutputPort.java similarity index 95% rename from usecase/src/main/java/blisgo/usecase/port/WasteOutputPort.java rename to usecase/src/main/java/blisgo/usecase/port/domain/WasteOutputPort.java index 3c4f47a..7eb9bc9 100644 --- a/usecase/src/main/java/blisgo/usecase/port/WasteOutputPort.java +++ b/usecase/src/main/java/blisgo/usecase/port/domain/WasteOutputPort.java @@ -1,4 +1,4 @@ -package blisgo.usecase.port; +package blisgo.usecase.port.domain; import blisgo.domain.dictionary.Waste; import blisgo.domain.dictionary.vo.Category; diff --git a/usecase/src/main/java/blisgo/usecase/port/infra/CommunityScheduler.java b/usecase/src/main/java/blisgo/usecase/port/infra/CommunityScheduler.java new file mode 100644 index 0000000..38d5e10 --- /dev/null +++ b/usecase/src/main/java/blisgo/usecase/port/infra/CommunityScheduler.java @@ -0,0 +1,4 @@ +package blisgo.usecase.port.infra; + +public interface CommunityScheduler { +} diff --git a/usecase/src/main/java/blisgo/usecase/port/infra/DictionaryScheduler.java b/usecase/src/main/java/blisgo/usecase/port/infra/DictionaryScheduler.java new file mode 100644 index 0000000..33d26b3 --- /dev/null +++ b/usecase/src/main/java/blisgo/usecase/port/infra/DictionaryScheduler.java @@ -0,0 +1,4 @@ +package blisgo.usecase.port.infra; + +public interface DictionaryScheduler { +} diff --git a/usecase/src/main/java/blisgo/usecase/port/infra/FileUploadInputPort.java b/usecase/src/main/java/blisgo/usecase/port/infra/FileUploadInputPort.java new file mode 100644 index 0000000..3094a81 --- /dev/null +++ b/usecase/src/main/java/blisgo/usecase/port/infra/FileUploadInputPort.java @@ -0,0 +1,19 @@ +package blisgo.usecase.port.infra; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.Resource; +import org.springframework.stereotype.Service; + +import java.net.URI; + +@Slf4j +@Service +@RequiredArgsConstructor +public class FileUploadInputPort { + private final FileUploadOutputPort port; + + public URI upload(Resource resource) { + return port.uploadFile(resource); + } +} diff --git a/usecase/src/main/java/blisgo/usecase/port/infra/FileUploadOutputPort.java b/usecase/src/main/java/blisgo/usecase/port/infra/FileUploadOutputPort.java new file mode 100644 index 0000000..1ac4e06 --- /dev/null +++ b/usecase/src/main/java/blisgo/usecase/port/infra/FileUploadOutputPort.java @@ -0,0 +1,9 @@ +package blisgo.usecase.port.infra; + +import org.springframework.core.io.Resource; + +import java.net.URI; + +public interface FileUploadOutputPort { + URI uploadFile(Resource resource); +} \ No newline at end of file diff --git a/usecase/src/main/java/blisgo/usecase/port/infra/SchedulerInputPort.java b/usecase/src/main/java/blisgo/usecase/port/infra/SchedulerInputPort.java new file mode 100644 index 0000000..6128d15 --- /dev/null +++ b/usecase/src/main/java/blisgo/usecase/port/infra/SchedulerInputPort.java @@ -0,0 +1,10 @@ +package blisgo.usecase.port.infra; + +public interface SchedulerInputPort { + + void changeUIIndexWallpaperDaily(); + + void updateDictionaryPopularity(); + + void updateViewCounts(); +} diff --git a/usecase/src/main/java/blisgo/usecase/port/infra/UIScheduler.java b/usecase/src/main/java/blisgo/usecase/port/infra/UIScheduler.java new file mode 100644 index 0000000..6f53203 --- /dev/null +++ b/usecase/src/main/java/blisgo/usecase/port/infra/UIScheduler.java @@ -0,0 +1,4 @@ +package blisgo.usecase.port.infra; + +public interface UIScheduler { +} diff --git a/usecase/src/main/java/blisgo/usecase/request/post/AddPost.java b/usecase/src/main/java/blisgo/usecase/request/post/AddPost.java index 51d312d..0f705fd 100644 --- a/usecase/src/main/java/blisgo/usecase/request/post/AddPost.java +++ b/usecase/src/main/java/blisgo/usecase/request/post/AddPost.java @@ -2,9 +2,11 @@ import lombok.Builder; -@Builder +@Builder(toBuilder = true) public record AddPost( String title, - String content + String content, + String thumbnail, + String preview ) { } diff --git a/usecase/src/main/java/blisgo/usecase/request/post/UpdatePost.java b/usecase/src/main/java/blisgo/usecase/request/post/UpdatePost.java index 9241bfd..124cef6 100644 --- a/usecase/src/main/java/blisgo/usecase/request/post/UpdatePost.java +++ b/usecase/src/main/java/blisgo/usecase/request/post/UpdatePost.java @@ -6,6 +6,8 @@ public record UpdatePost( Long postId, String title, - String content + String content, + String thumbnail, + String preview ) { } diff --git a/usecase/src/main/java/blisgo/usecase/request/waste/GetWaste.java b/usecase/src/main/java/blisgo/usecase/request/waste/GetWaste.java index 0557a9d..66ef512 100644 --- a/usecase/src/main/java/blisgo/usecase/request/waste/GetWaste.java +++ b/usecase/src/main/java/blisgo/usecase/request/waste/GetWaste.java @@ -1,12 +1,16 @@ package blisgo.usecase.request.waste; +import blisgo.domain.dictionary.vo.Category; import lombok.Builder; import org.springframework.data.domain.Pageable; +import java.util.List; + @Builder public record GetWaste( Pageable pageable, Long wasteId, - Long lastWasteId + Long lastWasteId, + List categories ) { } diff --git a/usecase/src/main/java/blisgo/usecase/request/waste/WasteQuery.java b/usecase/src/main/java/blisgo/usecase/request/waste/WasteQuery.java index c0f18b1..895fab7 100644 --- a/usecase/src/main/java/blisgo/usecase/request/waste/WasteQuery.java +++ b/usecase/src/main/java/blisgo/usecase/request/waste/WasteQuery.java @@ -20,4 +20,6 @@ public interface WasteQuery { Slice getWastesFromDogam(GetDogam query); List getWastesRelated(List categories); + + List getWastesRelated(GetWaste query); } diff --git "a/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" "b/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" index dd790e5..090e278 100644 Binary files "a/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" and "b/\353\266\204\353\246\254\343\205\205\343\204\261V4.bsdesign" differ