@@ -27,7 +27,6 @@ public class VideoController {
2727 @ Autowired
2828 private VideoService videoService ;
2929
30- @ CrossOrigin (origins = "*" )
3130 @ PostMapping ("/upload" )
3231 public ResponseEntity <?> upload (@ RequestParam ("file" ) MultipartFile file ,
3332 @ RequestParam ("userID" ) String userID ,
@@ -41,7 +40,6 @@ public ResponseEntity<?> upload(@RequestParam("file") MultipartFile file,
4140 }
4241
4342
44- @ CrossOrigin (origins = "*" )
4543 @ GetMapping ("/get/{id}" )
4644 public ResponseEntity <?> download (@ PathVariable String id ,
4745 @ RequestHeader (value = HttpHeaders .RANGE , required = false ) String rangeHeader ) throws IOException {
@@ -87,57 +85,48 @@ public ResponseEntity<?> download(@PathVariable String id,
8785 .body (inputStreamResource );
8886 }
8987
90- @ CrossOrigin (origins = "*" )
9188 @ GetMapping ("/getDetails/{videoId}" )
9289 public Map <String , Object > getVideoDetails (@ PathVariable String videoId ) {
9390 return videoService .getDetails (videoId );
9491 }
9592
96- @ CrossOrigin (origins = "*" )
9793 @ GetMapping ("/getDetailsByUserId/{userId}" )
9894 public ResponseEntity <?> getVideoDetailsByUserId (@ PathVariable String userId ) {
9995 return new ResponseEntity <>(videoService .getDetailsByUserId (userId ), HttpStatus .OK );
10096 }
10197
102- @ CrossOrigin (origins = "*" )
10398 @ GetMapping ("/getAllIds" )
10499 public ResponseEntity <?> getAllID () {
105100 return new ResponseEntity <>(videoService .getAllVideoIDs (), HttpStatus .OK );
106101 }
107102
108- @ CrossOrigin (origins = "*" )
109103 @ GetMapping ("/listIdThumbnail" )
110104 public ResponseEntity <?> listIdThumbnail () {
111105 return new ResponseEntity <>(videoService .listIdThumbnail (), HttpStatus .OK );
112106 }
113107
114- @ CrossOrigin (origins = "*" )
115108 @ GetMapping ("/getThumbnailIdByUserId/{id}" )
116109 public ResponseEntity <?> getThumbnailIdByUserId (@ PathVariable String id ) {
117110 return new ResponseEntity <>(videoService .getThumbnailIdByUserId (id ), HttpStatus .OK );
118111 }
119112
120- @ CrossOrigin (origins = "*" )
121113 @ GetMapping ("/getVideoIdFromThumbnailId/{id}" )
122114 public ResponseEntity <?> getVideoIdFromThumbnailId (@ PathVariable String id ) {
123115 return new ResponseEntity <>(videoService .getVideoIdFromThumbnailId (id ), HttpStatus .OK );
124116 }
125117
126- @ CrossOrigin (origins = "*" )
127118 @ PutMapping ("/updateViews/{id}" )
128119 public ResponseEntity <?> updateViews (@ PathVariable String id ) {
129120 videoService .updateViews (id );
130121 return new ResponseEntity <>(HttpStatus .OK );
131122 }
132123
133- @ CrossOrigin (origins = "*" )
134124 @ PutMapping ("/updateLikes/{id}" )
135125 public ResponseEntity <?> updateLikes (@ PathVariable String id ) {
136126 videoService .updateLikes (id );
137127 return new ResponseEntity <>(HttpStatus .OK );
138128 }
139129
140- @ CrossOrigin (origins = "*" )
141130 @ PutMapping ("/updateDislikes/{id}" )
142131 public ResponseEntity <?> updateDislikes (@ PathVariable String id ) {
143132 videoService .updateDislikes (id );
@@ -181,31 +170,27 @@ public int read(byte[] b, int off, int len) throws IOException {
181170
182171
183172 //Hanlde Subcri
184- @ CrossOrigin (origins = "*" )
185173 @ PostMapping ("/subscribe" )
186174 public ResponseEntity <?> subscribe (@ RequestParam ("subscriberId" ) String subscriberId ,
187175 @ RequestParam ("subscribedToId" ) String subscribedToId ) {
188176 videoService .subscribe (subscriberId , subscribedToId );
189177 return new ResponseEntity <>(HttpStatus .OK );
190178 }
191179
192- @ CrossOrigin (origins = "*" )
193180 @ PostMapping ("/unsubscribe" )
194181 public ResponseEntity <?> unsubscribe (@ RequestParam ("subscriberId" ) String subscriberId ,
195182 @ RequestParam ("subscribedToId" ) String subscribedToId ) {
196183 videoService .unsubscribe (subscriberId , subscribedToId );
197184 return new ResponseEntity <>(HttpStatus .OK );
198185 }
199186
200- @ CrossOrigin (origins = "*" )
201187 @ GetMapping ("/isSubscribed" )
202188 public ResponseEntity <Boolean > isSubscribed (@ RequestParam ("subscriberId" ) String subscriberId ,
203189 @ RequestParam ("subscribedToId" ) String subscribedToId ) {
204190 boolean isSubscribed = videoService .isSubscribed (subscriberId , subscribedToId );
205191 return new ResponseEntity <>(isSubscribed , HttpStatus .OK );
206192 }
207193
208- @ CrossOrigin (origins = "*" )
209194 @ GetMapping ("/getSubscriberCount" )
210195 public ResponseEntity <Long > getSubscriberCount (@ RequestParam ("userId" ) String userId ) {
211196 long subscriberCount = videoService .getSubscriberCount (userId );
@@ -214,39 +199,34 @@ public ResponseEntity<Long> getSubscriberCount(@RequestParam("userId") String us
214199
215200
216201 //Handle Like
217- @ CrossOrigin (origins = "*" )
218202 @ PostMapping ("/like" )
219203 public ResponseEntity <?> like (@ RequestParam ("likerToId" ) String likerToId ,
220204 @ RequestParam ("likedToId" ) String likedToId ) {
221205 videoService .like (likerToId , likedToId );
222206 return new ResponseEntity <>(HttpStatus .OK );
223207 }
224208
225- @ CrossOrigin (origins = "*" )
226209 @ PostMapping ("/unlike" )
227210 public ResponseEntity <?> unlike (@ RequestParam ("likerToId" ) String likerToId ,
228211 @ RequestParam ("likedToId" ) String likedToId ) {
229212 videoService .unlike (likerToId , likedToId );
230213 return new ResponseEntity <>(HttpStatus .OK );
231214 }
232215
233- @ CrossOrigin (origins = "*" )
234216 @ GetMapping ("/isLiked" )
235217 public ResponseEntity <Boolean > isLiked (@ RequestParam ("likerToId" ) String likerToId ,
236218 @ RequestParam ("likedToId" ) String likedToId ) {
237219 boolean isLiked = videoService .isLiked (likerToId , likedToId );
238220 return new ResponseEntity <>(isLiked , HttpStatus .OK );
239221 }
240222
241- @ CrossOrigin (origins = "*" )
242223 @ GetMapping ("/getLikeCount" )
243224 public ResponseEntity <Long > getLikeCount (@ RequestParam ("videoId" ) String videoId ) {
244225 long likeCount = videoService .getLikeCount (videoId );
245226 return new ResponseEntity <>(likeCount , HttpStatus .OK );
246227 }
247228
248229
249- @ CrossOrigin (origins = "*" )
250230 @ GetMapping ("/getIdFromLikerToId/{likerToId}" )
251231 public ResponseEntity <?> getIdFromLikerToId (@ PathVariable String likerToId ) {
252232 return new ResponseEntity <>(videoService .getLikedToIdsFromLikerToId (likerToId ), HttpStatus .OK );
0 commit comments