Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#70] cursor color 추가 #71

Merged
merged 13 commits into from
May 14, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.beans.factory.annotation.Value;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand All @@ -34,7 +35,6 @@ public LiveblocksTokenDto GetRoomAuthToken(String userId, String name,String img
String jsonBody = createJsonBody(userId,name,img,projectIds);

HttpEntity<String> request = new HttpEntity<>(jsonBody, headers);
// System.out.print(request);

return restTemplate.postForObject(url, request, LiveblocksTokenDto.class);
}
Expand All @@ -51,18 +51,18 @@ private String createJsonBody(String userId,String name, String img, List<String
} catch (JsonProcessingException e) {
e.printStackTrace();
}

String[] randomColorPair = getRandomColorPair();
String data = String.format("""
{
"userId": "%s",
"userInfo": {
"name": "%s",
"color":["%s","%s"],
"avatar": "%s"
},
"permissions": %s
}
""", userId, name, img, permissionsJson);
System.out.println(data);
""", userId, name,randomColorPair[0],randomColorPair[1], img, permissionsJson);
return data;
}

Expand Down Expand Up @@ -93,5 +93,43 @@ public LiveblocksTokenDto Test(String userId, String roomId) {

return restTemplate.postForObject(url, request, LiveblocksTokenDto.class);
}
// colors 배열
private static String[][] colors = {
{"#FF0099", "#FF7A00"},
{"#002A95", "#00A0D2"},
{"#6116FF", "#E32DD1"},
{"#0EC4D1", "#1BCC00"},
{"#FF00C3", "#FF3333"},
{"#00C04D", "#00FFF0"},
{"#5A2BBE", "#C967EC"},
{"#46BE2B", "#67EC86"},
{"#F49300", "#FFE600"},
{"#F42900", "#FF9000"},
{"#00FF94", "#0094FF"},
{"#00FF40", "#1500FF"},
{"#00FFEA", "#BF00FF"},
{"#FFD600", "#BF00FF"},
{"#484559", "#282734"},
{"#881B9A", "#1D051E"},
{"#FF00F5", "#00FFD1"},
{"#9A501B", "#1E0505"},
{"#FF008A", "#FAFF00"},
{"#22BC09", "#002B1B"},
{"#FF0000", "#000000"},
{"#00FFB2", "#000000"},
{"#0066FF", "#000000"},
{"#FA00FF", "#000000"},
{"#00A3FF", "#000000"},
{"#00FF94", "#000000"},
{"#AD00FF", "#000000"},
{"#F07777", "#4E0073"},
{"#AC77F0", "#003C73"}
};

public static String[] getRandomColorPair() {
Random random = new Random();
int index = random.nextInt(colors.length);
return colors[index];
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ private MakeUserStoryResponseDto promptUserStory(OpenAIToken finalToken, ObjectM
String requestTextForEpic = createRequestForEpic(scenario);
System.out.println(requestTextForEpic);
Map<String, Object> Epic = prompt(finalToken, om, requestTextForEpic);

String requestTextForUserstory = promptForUserStory.replace("{epics}", getMessage(Epic));
String requestTextForUserstory = promptForUserStory.replace("{epics}", "\""+getMessage(Epic)+"\"");
Map<String, Object> userStory = prompt(finalToken, om, requestTextForUserstory);
System.out.println(getMessage(userStory));
String res = extractJson(getMessage(userStory));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.syncd.domain.project.Project;
import com.syncd.domain.project.UserInProject;
import com.syncd.domain.user.User;
import com.syncd.dto.LiveblocksTokenDto;
import com.syncd.dto.MakeUserStoryResponseDto;
import com.syncd.dto.UserRoleDto;
import com.syncd.enums.Role;
Expand Down Expand Up @@ -88,7 +89,9 @@ public GetRoomAuthTokenResponseDto getRoomAuthToken(String userId) {
.map(Project::getId)
.collect(Collectors.toList());
User userInfo = readUserPort.findByUserId(userId);
return new GetRoomAuthTokenResponseDto(liveblocksPort.GetRoomAuthToken(userId, userInfo.getName(), userInfo.getProfileImg(), projectIds).token());
String liveblocksTokenDto = liveblocksPort.GetRoomAuthToken(userId, userInfo.getName(), userInfo.getProfileImg(), projectIds).token();
System.out.println(liveblocksTokenDto);
return new GetRoomAuthTokenResponseDto(liveblocksTokenDto);
}

@Override
Expand Down
Loading