From 265e116a3410273a33d7dc1bde892eb65fba8472 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 21 Aug 2017 12:32:18 +0300 Subject: api: cleanup unused injections --- .../src/main/java/com/juick/api/controllers/Messages.java | 8 +------- .../main/java/com/juick/api/controllers/Notifications.java | 8 ++++---- .../src/main/java/com/juick/api/controllers/Others.java | 7 ++----- juick-api/src/main/java/com/juick/api/controllers/PM.java | 6 +++--- juick-api/src/main/java/com/juick/api/controllers/Post.java | 12 ++++++------ .../main/java/com/juick/api/controllers/Subscriptions.java | 9 +++------ juick-api/src/main/java/com/juick/api/controllers/Tags.java | 7 ++----- .../main/java/com/juick/api/controllers/TelegramWebhook.java | 6 +++--- juick-api/src/main/java/com/juick/api/controllers/Users.java | 2 +- 9 files changed, 25 insertions(+), 40 deletions(-) (limited to 'juick-api/src/main/java/com/juick/api/controllers') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java index d81db3b2..b11c39c5 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java @@ -20,15 +20,12 @@ package com.juick.api.controllers; import com.juick.Status; import com.juick.Tag; import com.juick.User; -import com.juick.api.ApiServer; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; +import com.juick.server.util.UserUtils; import com.juick.service.MessagesService; import com.juick.service.TagService; import com.juick.service.UserService; -import com.juick.server.util.UserUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -45,7 +42,6 @@ import java.util.List; @RestController @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public class Messages { - private static final Logger logger = LoggerFactory.getLogger(Messages.class); private static final ResponseEntity> NOT_FOUND = ResponseEntity .status(HttpStatus.NOT_FOUND) @@ -61,8 +57,6 @@ public class Messages { private UserService userService; @Inject private TagService tagService; - @Inject - private ApiServer apiServer; // TODO: serialize image urls diff --git a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java index d2669253..c08689aa 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java @@ -47,13 +47,13 @@ import java.util.stream.Collectors; public class Notifications { @Inject - PushQueriesService pushQueriesService; + private PushQueriesService pushQueriesService; @Inject - MessagesService messagesService; + private MessagesService messagesService; @Inject - SubscriptionService subscriptionService; + private SubscriptionService subscriptionService; @Inject - UserService userService; + private UserService userService; private User collectTokens(Integer uid) { diff --git a/juick-api/src/main/java/com/juick/api/controllers/Others.java b/juick-api/src/main/java/com/juick/api/controllers/Others.java index f9d78187..4245de81 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Others.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Others.java @@ -21,9 +21,8 @@ import com.juick.User; import com.juick.server.helpers.PrivateChats; import com.juick.server.util.HttpForbiddenException; import com.juick.server.util.HttpNotFoundException; -import com.juick.service.PMQueriesService; -import com.juick.service.UserService; import com.juick.server.util.UserUtils; +import com.juick.service.PMQueriesService; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -39,9 +38,7 @@ import java.util.List; @RestController public class Others { @Inject - PMQueriesService pmQueriesService; - @Inject - UserService userService; + private PMQueriesService pmQueriesService; @RequestMapping(value = "groups_pms", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public PrivateChats doGetGroupsPMs( diff --git a/juick-api/src/main/java/com/juick/api/controllers/PM.java b/juick-api/src/main/java/com/juick/api/controllers/PM.java index 9d985991..e909a4b5 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/PM.java +++ b/juick-api/src/main/java/com/juick/api/controllers/PM.java @@ -42,11 +42,11 @@ import java.util.List; @RestController public class PM { @Inject - UserService userService; + private UserService userService; @Inject - PMQueriesService pmQueriesService; + private PMQueriesService pmQueriesService; @Inject - ApiServer apiServer; + private ApiServer apiServer; @RequestMapping(value = "/pm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public List doGetPM( diff --git a/juick-api/src/main/java/com/juick/api/controllers/Post.java b/juick-api/src/main/java/com/juick/api/controllers/Post.java index 4654f48c..7696b7d8 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Post.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Post.java @@ -62,17 +62,17 @@ public class Post { private static Logger logger = LoggerFactory.getLogger(ApiServer.class); @Inject - UserService userService; + private UserService userService; @Inject - ApiServer apiServer; + private ApiServer apiServer; @Inject - MessagesService messagesService; + private MessagesService messagesService; @Inject - SubscriptionService subscriptionService; + private SubscriptionService subscriptionService; @Value("${upload_tmp_dir:/var/www/juick.com/i/tmp/}") - String tmpDir; + private String tmpDir; @Value("${img_path:/var/www/juick.com/i/}") - String imgDir; + private String imgDir; @RequestMapping(value = "/post", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseStatus(value = HttpStatus.OK) diff --git a/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java b/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java index a9452107..06ea9fcf 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java @@ -21,10 +21,9 @@ import com.juick.Message; import com.juick.User; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; +import com.juick.server.util.UserUtils; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; -import com.juick.service.UserService; -import com.juick.server.util.UserUtils; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -41,11 +40,9 @@ import java.util.List; @RestController public class Subscriptions { @Inject - UserService userService; - @Inject - SubscriptionService subscriptionService; + private SubscriptionService subscriptionService; @Inject - MessagesService messagesService; + private MessagesService messagesService; @RequestMapping(value = "/subscriptions", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public List doGet( diff --git a/juick-api/src/main/java/com/juick/api/controllers/Tags.java b/juick-api/src/main/java/com/juick/api/controllers/Tags.java index d980b95f..85bb1ba4 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Tags.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Tags.java @@ -19,9 +19,8 @@ package com.juick.api.controllers; import com.juick.User; import com.juick.server.helpers.TagStats; -import com.juick.service.TagService; -import com.juick.service.UserService; import com.juick.server.util.UserUtils; +import com.juick.service.TagService; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -37,9 +36,7 @@ import java.util.List; @RestController public class Tags { @Inject - UserService userService; - @Inject - TagService tagService; + private TagService tagService; @RequestMapping(value = "/tags", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public List tags( diff --git a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java index 718ea052..be29ee62 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java +++ b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java @@ -46,11 +46,11 @@ import java.util.List; public class TelegramWebhook { private static Logger logger = LoggerFactory.getLogger(TelegramWebhook.class); @Inject - UserService usersService; + private UserService usersService; @Inject - TelegramService telegramService; + private TelegramService telegramService; @Inject - TGBot tgBot; + private TGBot tgBot; @RequestMapping(value = "/tlgmbtwbhk", method = RequestMethod.POST) diff --git a/juick-api/src/main/java/com/juick/api/controllers/Users.java b/juick-api/src/main/java/com/juick/api/controllers/Users.java index 6439c1cb..35bd229b 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Users.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Users.java @@ -39,7 +39,7 @@ import java.util.List; @RestController public class Users { @Inject - UserService userService; + private UserService userService; @RequestMapping(value = "/users", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public List doGetUsers( -- cgit v1.2.3