Skip to content

Commit

Permalink
Merge pull request #95 from sgdevcamp2023/feat/#94
Browse files Browse the repository at this point in the history
Feat/#94 음원 좋아요 API 구현
  • Loading branch information
kor-Chipmunk authored Feb 21, 2024
2 parents 75fcbb0 + c168ba1 commit b4c9534
Show file tree
Hide file tree
Showing 21 changed files with 350 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,23 @@ public class PassportExtractor {

private static final String USER_INFO = "userInfo";
private static final String AUTHORIZATION_HEADER_NAME = "Authorization";
private static final String BEARER = "Bearer";
private final ObjectMapper objectMapper;
private final PassportValidator passportValidator;

public Passport getPassportFromRequestHeader(HttpServletRequest httpServletRequest) {
try {
String authorization = httpServletRequest.getHeader(AUTHORIZATION_HEADER_NAME);
if (authorization == null) {
throw new BusinessException(ErrorCode.INVALID_PASSPORT);
}

if (authorization.startsWith(BEARER + " ")) {
authorization = authorization.split(" ")[1];
}

return objectMapper.readValue(
new String(
Base64.getDecoder().decode(httpServletRequest.getHeader(AUTHORIZATION_HEADER_NAME)),
StandardCharsets.UTF_8),
new String(Base64.getDecoder().decode(authorization), StandardCharsets.UTF_8),
Passport.class);
} catch (JsonProcessingException e) {
throw new BusinessException(ErrorCode.INVALID_PASSPORT);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.lalala.mvc.response;

import java.util.TreeMap;

import lombok.extern.slf4j.Slf4j;

import org.springframework.core.MethodParameter;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
Expand All @@ -30,6 +33,12 @@ public Object beforeBodyWrite(
Class<? extends HttpMessageConverter<?>> selectedConverterType,
ServerHttpRequest request,
ServerHttpResponse response) {
// Swagger 예외 처리
if (body.getClass() == TreeMap.class
|| selectedConverterType == ByteArrayHttpMessageConverter.class) {
return body;
}

if (body instanceof BaseResponse<?>) {
return body;
}
Expand Down
42 changes: 21 additions & 21 deletions src/backend/music-server/infra/02_albums_202402151519.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_count,created_at,updated_at) VALUES
(1,'SINGLE','All I Need','2024-02-15 12:41:31','http://localhost:30000/971ee18a-9f87-4cd0-ab8f-81a20fa0fee4.jpg',0,'2024-02-15 12:41:31','2024-02-15 12:41:31'),
(2,'SINGLE','Talk About','2024-02-15 12:53:16','http://localhost:30000/fe2f7f22-37a8-4885-8977-a50d28791add.jpg',0,'2024-02-15 12:53:16','2024-02-15 12:53:16'),
(3,'SINGLE','Waves','2024-02-15 12:55:57','http://localhost:30000/4ff65b52-13ea-4131-96a0-71c76efd2885.jpeg',0,'2024-02-15 12:55:57','2024-02-15 12:55:57'),
(1,'SINGLE','All I Need','2024-02-15 12:41:31','http://fileserver-app:30000/971ee18a-9f87-4cd0-ab8f-81a20fa0fee4.jpg',0,'2024-02-15 12:41:31','2024-02-15 12:41:31'),
(2,'SINGLE','Talk About','2024-02-15 12:53:16','http://fileserver-app:30000/fe2f7f22-37a8-4885-8977-a50d28791add.jpg',0,'2024-02-15 12:53:16','2024-02-15 12:53:16'),
(3,'SINGLE','Waves','2024-02-15 12:55:57','http://fileserver-app:30000/4ff65b52-13ea-4131-96a0-71c76efd2885.jpeg',0,'2024-02-15 12:55:57','2024-02-15 12:55:57'),
(5,'SINGLE','Various Album','2024-02-15 13:20:06','',0,'2024-02-15 13:20:06','2024-02-15 13:20:06'),
(6,'SINGLE','Various Album','2024-02-15 13:20:30','',0,'2024-02-15 13:20:30','2024-02-15 13:20:30'),
(7,'SINGLE','Various Album','2024-02-15 13:20:40','',0,'2024-02-15 13:20:40','2024-02-15 13:20:40'),
Expand All @@ -10,11 +10,11 @@ INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_coun
(10,'SINGLE','Various Album','2024-02-15 13:35:03','',0,'2024-02-15 13:35:03','2024-02-15 13:35:03'),
(11,'SINGLE','Various Album','2024-02-15 13:36:38','',0,'2024-02-15 13:36:38','2024-02-15 13:36:38');
INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_count,created_at,updated_at) VALUES
(12,'SINGLE','All I Need','2024-02-15 14:09:03','http://localhost:30000/44569839-e962-4521-bd8f-1148de83720c.jpg',0,'2024-02-15 14:09:03','2024-02-15 14:09:03'),
(12,'SINGLE','All I Need','2024-02-15 14:09:03','http://fileserver-app:30000/44569839-e962-4521-bd8f-1148de83720c.jpg',0,'2024-02-15 14:09:03','2024-02-15 14:09:03'),
(13,'SINGLE','Various Album','2024-02-15 14:09:54','',0,'2024-02-15 14:09:54','2024-02-15 14:09:54'),
(14,'SINGLE','Bad Girl','2024-02-15 14:10:13','http://localhost:30000/5b8bcdb1-1b6d-429b-8687-a53a450f2444.jpeg',0,'2024-02-15 14:10:13','2024-02-15 14:10:13'),
(14,'SINGLE','Bad Girl','2024-02-15 14:10:13','http://fileserver-app:30000/5b8bcdb1-1b6d-429b-8687-a53a450f2444.jpeg',0,'2024-02-15 14:10:13','2024-02-15 14:10:13'),
(15,'SINGLE','Various Album','2024-02-15 14:10:32','',0,'2024-02-15 14:10:32','2024-02-15 14:10:32'),
(16,'SINGLE','Calling For You','2024-02-15 14:10:42','http://localhost:30000/8ee3a9a8-32f9-4ee1-839b-e9d5c6a82577.jpg',0,'2024-02-15 14:10:42','2024-02-15 14:10:42'),
(16,'SINGLE','Calling For You','2024-02-15 14:10:42','http://fileserver-app:30000/8ee3a9a8-32f9-4ee1-839b-e9d5c6a82577.jpg',0,'2024-02-15 14:10:42','2024-02-15 14:10:42'),
(17,'SINGLE','Various Album','2024-02-15 14:12:20','',0,'2024-02-15 14:12:20','2024-02-15 14:12:20'),
(18,'SINGLE','Various Album','2024-02-15 14:13:14','',0,'2024-02-15 14:13:14','2024-02-15 14:13:14'),
(19,'SINGLE','Various Album','2024-02-15 14:13:25','',0,'2024-02-15 14:13:25','2024-02-15 14:13:25'),
Expand All @@ -29,48 +29,48 @@ INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_coun
(27,'SINGLE','Various Album','2024-02-15 14:19:53','',0,'2024-02-15 14:19:53','2024-02-15 14:19:53'),
(28,'SINGLE','Various Album','2024-02-15 14:20:10','',0,'2024-02-15 14:20:10','2024-02-15 14:20:10'),
(29,'SINGLE','Various Album','2024-02-15 14:20:21','',0,'2024-02-15 14:20:21','2024-02-15 14:20:21'),
(30,'SINGLE','Nunca','2024-02-15 14:23:37','http://localhost:30000/54081e8c-7433-4fcc-a5e9-dcc26a8f25da.jpeg',0,'2024-02-15 14:23:37','2024-02-15 14:23:37'),
(30,'SINGLE','Nunca','2024-02-15 14:23:37','http://fileserver-app:30000/54081e8c-7433-4fcc-a5e9-dcc26a8f25da.jpeg',0,'2024-02-15 14:23:37','2024-02-15 14:23:37'),
(31,'SINGLE','Various Album','2024-02-15 14:26:17','',0,'2024-02-15 14:26:17','2024-02-15 14:26:17');
INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_count,created_at,updated_at) VALUES
(32,'SINGLE','Various Album','2024-02-15 14:26:32','',0,'2024-02-15 14:26:32','2024-02-15 14:26:32'),
(33,'SINGLE','Various Album','2024-02-15 14:27:19','',0,'2024-02-15 14:27:19','2024-02-15 14:27:19'),
(33,'SINGLE','Indecisive ','2024-02-15 14:27:31','http://localhost:30000/aab737f9-0220-4034-ba4d-90d691982741.png',0,'2024-02-15 14:27:31','2024-02-15 14:27:31'),
(33,'SINGLE','Indecisive ','2024-02-15 14:27:31','http://fileserver-app:30000/aab737f9-0220-4034-ba4d-90d691982741.png',0,'2024-02-15 14:27:31','2024-02-15 14:27:31'),
(34,'SINGLE','Various Album','2024-02-15 14:27:54','',0,'2024-02-15 14:27:54','2024-02-15 14:27:54'),
(35,'SINGLE','Various Album','2024-02-15 14:28:01','',0,'2024-02-15 14:28:01','2024-02-15 14:28:01'),
(36,'SINGLE','Various Album','2024-02-15 14:28:20','',0,'2024-02-15 14:28:20','2024-02-15 14:28:20'),
(37,'SINGLE','Various Album','2024-02-15 14:28:50','',0,'2024-02-15 14:28:51','2024-02-15 14:28:51'),
(38,'SINGLE','Gone For Good','2024-02-15 14:29:16','http://localhost:30000/a8155c03-4c5d-49fd-8383-03843604a0eb.png',0,'2024-02-15 14:29:16','2024-02-15 14:29:16'),
(38,'SINGLE','Gone For Good','2024-02-15 14:29:16','http://fileserver-app:30000/a8155c03-4c5d-49fd-8383-03843604a0eb.png',0,'2024-02-15 14:29:16','2024-02-15 14:29:16'),
(39,'SINGLE','Various Album','2024-02-15 14:29:42','',0,'2024-02-15 14:29:42','2024-02-15 14:29:42'),
(40,'SINGLE','Various Album','2024-02-15 14:29:54','',0,'2024-02-15 14:29:54','2024-02-15 14:29:54');
INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_count,created_at,updated_at) VALUES
(40,'SINGLE','paradise ','2024-02-15 14:30:01','http://localhost:30000/03dca986-7ede-4ecb-8b88-6102f2463600.png',0,'2024-02-15 14:30:01','2024-02-15 14:30:01'),
(40,'SINGLE','paradise ','2024-02-15 14:30:01','http://fileserver-app:30000/03dca986-7ede-4ecb-8b88-6102f2463600.png',0,'2024-02-15 14:30:01','2024-02-15 14:30:01'),
(41,'SINGLE','Various Album','2024-02-15 14:30:05','',0,'2024-02-15 14:30:05','2024-02-15 14:30:05'),
(42,'SINGLE','Various Album','2024-02-15 14:30:22','',0,'2024-02-15 14:30:22','2024-02-15 14:30:22'),
(43,'SINGLE','Various Album','2024-02-15 14:30:27','',0,'2024-02-15 14:30:27','2024-02-15 14:30:27'),
(44,'SINGLE','Various Album','2024-02-15 14:30:37','',0,'2024-02-15 14:30:37','2024-02-15 14:30:37'),
(45,'SINGLE','Various Album','2024-02-15 14:30:42','',0,'2024-02-15 14:30:42','2024-02-15 14:30:42'),
(46,'SINGLE','Various Album','2024-02-15 14:30:50','',0,'2024-02-15 14:30:50','2024-02-15 14:30:50'),
(47,'SINGLE','Various Album','2024-02-15 14:30:59','',0,'2024-02-15 14:30:59','2024-02-15 14:30:59'),
(48,'SINGLE','Pick Up The Pieces','2024-02-15 14:31:04','http://localhost:30000/9ebf5698-4109-4ecb-89ed-080a10f853da.jpeg',0,'2024-02-15 14:31:04','2024-02-15 14:31:04'),
(49,'SINGLE','Unbreakable','2024-02-15 14:31:28','http://localhost:30000/97acbe0e-bf17-47ff-98b7-159c9c99fbaa.jpeg',0,'2024-02-15 14:31:28','2024-02-15 14:31:28');
(48,'SINGLE','Pick Up The Pieces','2024-02-15 14:31:04','http://fileserver-app:30000/9ebf5698-4109-4ecb-89ed-080a10f853da.jpeg',0,'2024-02-15 14:31:04','2024-02-15 14:31:04'),
(49,'SINGLE','Unbreakable','2024-02-15 14:31:28','http://fileserver-app:30000/97acbe0e-bf17-47ff-98b7-159c9c99fbaa.jpeg',0,'2024-02-15 14:31:28','2024-02-15 14:31:28');
INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_count,created_at,updated_at) VALUES
(50,'SINGLE','Never Have I Felt This (VIP)','2024-02-15 14:31:43','http://localhost:30000/f638bde0-7caf-4e41-9c10-c453019c426d.jpeg',0,'2024-02-15 14:31:43','2024-02-15 14:31:43'),
(50,'SINGLE','Never Have I Felt This (VIP)','2024-02-15 14:31:43','http://fileserver-app:30000/f638bde0-7caf-4e41-9c10-c453019c426d.jpeg',0,'2024-02-15 14:31:43','2024-02-15 14:31:43'),
(51,'SINGLE','Various Album','2024-02-15 14:31:55','',0,'2024-02-15 14:31:55','2024-02-15 14:31:55'),
(52,'SINGLE','Various Album','2024-02-15 14:32:05','',0,'2024-02-15 14:32:05','2024-02-15 14:32:05'),
(53,'SINGLE','Various Album','2024-02-15 14:32:28','',0,'2024-02-15 14:32:28','2024-02-15 14:32:28'),
(54,'SINGLE','Various Album','2024-02-15 14:32:42','',0,'2024-02-15 14:32:42','2024-02-15 14:32:42'),
(55,'SINGLE','Various Album','2024-02-15 14:32:58','',0,'2024-02-15 14:32:58','2024-02-15 14:32:58'),
(56,'SINGLE','Vienna ','2024-02-15 14:34:27','http://localhost:30000/b7a8a194-bd86-4423-8e43-b07207f43fc4.jpeg',0,'2024-02-15 14:34:27','2024-02-15 14:34:27'),
(57,'SINGLE','All For You ','2024-02-15 14:34:39','http://localhost:30000/5439c5cb-01e7-45bd-979f-16666bec3b9b.png',0,'2024-02-15 14:34:39','2024-02-15 14:34:39'),
(58,'SINGLE','Now I''m Broken ','2024-02-15 14:34:51','http://localhost:30000/ae0b2308-a5cf-4b74-b990-9cebd4651de8.jpeg',0,'2024-02-15 14:34:51','2024-02-15 14:34:51'),
(56,'SINGLE','Vienna ','2024-02-15 14:34:27','http://fileserver-app:30000/b7a8a194-bd86-4423-8e43-b07207f43fc4.jpeg',0,'2024-02-15 14:34:27','2024-02-15 14:34:27'),
(57,'SINGLE','All For You ','2024-02-15 14:34:39','http://fileserver-app:30000/5439c5cb-01e7-45bd-979f-16666bec3b9b.png',0,'2024-02-15 14:34:39','2024-02-15 14:34:39'),
(58,'SINGLE','Now I''m Broken ','2024-02-15 14:34:51','http://fileserver-app:30000/ae0b2308-a5cf-4b74-b990-9cebd4651de8.jpeg',0,'2024-02-15 14:34:51','2024-02-15 14:34:51'),
(58,'SINGLE','Various Album','2024-02-15 14:35:06','',0,'2024-02-15 14:35:06','2024-02-15 14:35:06');
INSERT INTO music.albums (artist_id,`type`,title,released_at,cover_url,like_count,created_at,updated_at) VALUES
(59,'SINGLE','Various Album','2024-02-15 14:35:34','',0,'2024-02-15 14:35:34','2024-02-15 14:35:34'),
(60,'SINGLE','Nocturnal ','2024-02-15 14:35:43','http://localhost:30000/4a2f78cc-da82-4ccc-823b-8ab24e126298.jpeg',0,'2024-02-15 14:35:43','2024-02-15 14:35:43'),
(61,'SINGLE','Hold On Me','2024-02-15 14:35:51','http://localhost:30000/6ada3ba2-62ad-4e73-a192-0d6351fa3518.jpeg',0,'2024-02-15 14:35:51','2024-02-15 14:35:51'),
(62,'SINGLE','Royalty ','2024-02-15 14:36:02','http://localhost:30000/748b755a-950c-48da-956c-eead7c607212.jpeg',0,'2024-02-15 14:36:02','2024-02-15 14:36:02'),
(60,'SINGLE','Nocturnal ','2024-02-15 14:35:43','http://fileserver-app:30000/4a2f78cc-da82-4ccc-823b-8ab24e126298.jpeg',0,'2024-02-15 14:35:43','2024-02-15 14:35:43'),
(61,'SINGLE','Hold On Me','2024-02-15 14:35:51','http://fileserver-app:30000/6ada3ba2-62ad-4e73-a192-0d6351fa3518.jpeg',0,'2024-02-15 14:35:51','2024-02-15 14:35:51'),
(62,'SINGLE','Royalty ','2024-02-15 14:36:02','http://fileserver-app:30000/748b755a-950c-48da-956c-eead7c607212.jpeg',0,'2024-02-15 14:36:02','2024-02-15 14:36:02'),
(63,'SINGLE','Various Album','2024-02-15 14:36:09','',0,'2024-02-15 14:36:09','2024-02-15 14:36:09'),
(64,'SINGLE','Various Album','2024-02-15 14:41:02','',0,'2024-02-15 14:41:02','2024-02-15 14:41:02'),
(65,'SINGLE','Memory Box','2024-02-15 14:41:07','http://localhost:30000/b1fec792-50a1-4b09-b23e-b6e0e609f5b2.jpeg',0,'2024-02-15 14:41:07','2024-02-15 14:41:07'),
(65,'SINGLE','Memory Box','2024-02-15 14:41:07','http://fileserver-app:30000/b1fec792-50a1-4b09-b23e-b6e0e609f5b2.jpeg',0,'2024-02-15 14:41:07','2024-02-15 14:41:07'),
(66,'SINGLE','Various Album','2024-02-15 14:41:11','',0,'2024-02-15 14:41:11','2024-02-15 14:41:11'),
(67,'SINGLE','Alone','2024-02-15 14:41:25','http://localhost:30000/6a46d356-c9ba-4d7c-bcea-70394fabb2ac.jpg',0,'2024-02-15 14:41:25','2024-02-15 14:41:25');
(67,'SINGLE','Alone','2024-02-15 14:41:25','http://fileserver-app:30000/6a46d356-c9ba-4d7c-bcea-70394fabb2ac.jpg',0,'2024-02-15 14:41:25','2024-02-15 14:41:25');
Loading

0 comments on commit b4c9534

Please sign in to comment.