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

데벨업 v2.0.3 Release #670

Merged
merged 4 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/secrets
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public List<Solution> findAllCompletedSolutionByHashTagName(String missionTitle,
.join(mission.missionHashTags.hashTags, missionHashTag).fetchJoin()
.join(missionHashTag.hashTag).fetchJoin()
.where(eqCompleted(), eqMissionTitle(missionTitle), eqHashTagName(hashTagName))
.orderBy(solution.id.desc())
.orderBy(solution.submittedAt.desc())
.fetch();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
Expand Down Expand Up @@ -46,6 +47,35 @@ public class SolutionRepositoryCustomTest extends IntegrationTestSupport {
@Autowired
private HashTagRepository hashTagRepository;

@Test
@DisplayName("솔루션을 제출일자 역순으로 조회할 수 있다.")
void findAllCompletedSolutionByHashTagOrderBySubmittedAtDesc() {
Member member = memberRepository.save(MemberTestData.defaultMember().build());
HashTag hashTag = hashTagRepository.save(HashTagTestData.defaultHashTag().withName("JAVA").build());
Mission mission1 = missionRepository.save(MissionTestData.defaultMission().withHashTags(List.of(hashTag)).build());
Mission mission2 = missionRepository.save(MissionTestData.defaultMission().withHashTags(List.of(hashTag)).build());
Solution solution1 = SolutionTestData.defaultSolution()
.withMember(member)
.withMission(mission1)
.withStatus(SolutionStatus.COMPLETED)
.withSubmittedAt(LocalDateTime.of(2024, 1, 1, 0, 0))
.build();
Solution solution2 = SolutionTestData.defaultSolution()
.withMember(member)
.withMission(mission2)
.withStatus(SolutionStatus.COMPLETED)
.withSubmittedAt(LocalDateTime.of(2024, 1, 2, 0, 0))
.build();

solutionRepository.saveAll(List.of(solution1, solution2));

List<Solution> solutions = solutionRepositoryCustom.findAllCompletedSolutionByHashTagName("all", "all");

assertThat(solutions)
.map(Solution::getId)
.containsExactly(solution2.getId(), solution1.getId());
}

@Test
@DisplayName("주어진 해시태그가 포함된 완료된 솔루션을 조회할 수 있다.")
void findAllCompletedSolutionByHashTag() {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/apis/solutions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { develupAPIClient } from '@/apis/clients/develupClient';
import { PATH } from '@/apis/paths';
import { HASHTAGS } from '@/constants/hashTags';
import type { HashTag } from '@/types';
import type { Solution, SubmittedSolution } from '@/types/solution';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function MissionDetailButtons({
const [isMissionStarted, setIsMissionStarted] = useState(isStarted);

const handleStartMission = () => {
handleModalOpen();
setIsMissionStarted(true);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styled from 'styled-components';
import javaIcon from '@/assets/images/java.svg';
import GithubLogo from '@/assets/images/githubLogo.svg';
import { Link } from 'react-router-dom';
import SanitizedMDPreview from '../common/SanitizedMDPreview';

export const SolutionDetailTitle = styled.h2`
margin: 4rem 0 2rem 0;
Expand Down Expand Up @@ -103,7 +104,7 @@ export const CodeViewButtonWrapper = styled.div`
margin: 3rem 0;
`;

export const SolutionDescription = styled.div`
export const SolutionDescription = styled(SanitizedMDPreview)`
margin-top: 3rem;
${({ theme }) => theme.font.body}
`;
Expand All @@ -120,4 +121,3 @@ export const SolutionDescriptionBottom = styled.div`
export const CodeViewButtonLink = styled(Link)`
display: contents;
`;

2 changes: 1 addition & 1 deletion frontend/src/components/SolutionDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function SolutionSection({ solution }: SolutionDetailProps) {
</Button>
</S.CodeViewButtonLink>
</S.CodeViewButtonWrapper>
<S.SolutionDescription>{description}</S.SolutionDescription>
<S.SolutionDescription source={description} />
{userInfo?.id === solution.member.id && (
<SolutionDetailBottom missionId={mission.id} solutionId={solutionId} />
)}
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/components/common/InfoCard/InfoCard.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ export const TitleWrapper = styled.div`
`;

export const Title = styled.div`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

${(props) => props.theme.font.bodyBold}
`;

export const Description = styled.div`
${(props) => props.theme.font.body}
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
text-overflow: ellipsis;

color: ${(props) => props.theme.colors.grey500};
margin-top: 0.5rem;
${(props) => props.theme.font.body}
`;

export const TagWrapper = styled.ul`
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/SolutionListPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function SolutionListPage() {
const [selectedHashTag, setSelectedHashTag] = useState<{ id: number; name: string } | null>(null);

const { data: allHashTags } = useHashTags();
const { data: allMissions } = useMissions(selectedHashTag?.name);
const { data: allMissions } = useMissions();

return (
<S.SolutionListPageContainer>
Expand Down
Loading