| Total Complexity | 2 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package com.base.Http.Server.Responses.Thread; |
||
| 8 | public class CreateChannelThreadResponse extends BaseResponse { |
||
| 9 | |||
| 10 | public static String VALID_SUBJECT = "Deploy to AWS ECS 2"; |
||
| 11 | public static String VALID_DESCRIPTION = "We need to Deploy the app on AWS ECS."; |
||
| 12 | public static String VALID_CHANNEL_SLUG = "development"; |
||
| 13 | public static String VALID_TEAM_SLUG = "twitter"; |
||
| 14 | public static String VALID_THREAD_SLUG = "deploy-to-aws-ecs-2"; |
||
| 15 | public static String INVALID_CHANNEL_SLUG = "development-1"; |
||
| 16 | public static int VALID_ID = 1; |
||
| 17 | |||
| 18 | @Override |
||
| 19 | public Response getResponse(Request request, Response response) { |
||
| 20 | return response.setStatusCode(200) |
||
| 21 | .setBody(generateResponseBody(createThread(request))); |
||
| 22 | } |
||
| 23 | |||
| 24 | public Thread createThread(Request request) { |
||
| 25 | return (Thread) (new Thread()) |
||
| 26 | .setDescription(request.getParameters().getOrDefault("description", "")) |
||
| 27 | .setSubject(request.getParameters().getOrDefault("subject", "")) |
||
| 28 | .setSlug(request.getParameters().getOrDefault("slug", VALID_THREAD_SLUG)) |
||
| 29 | .setId(VALID_ID); |
||
| 30 | } |
||
| 32 |