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

Merge Develop to Main #510

Merged
merged 60 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d2dd33e
Security Config bugfix for routes.
EnesBaserr Oct 27, 2024
3c77663
Tag entity.
EnesBaserr Oct 27, 2024
eae7675
Merge pull request #440 from bounswe/backend/feature/437-create-tag-e…
EnesBaserr Oct 27, 2024
7892ed6
Question entity.
EnesBaserr Oct 27, 2024
975b84f
Merge pull request #441 from bounswe/backend/feature/436-create-quest…
EnesBaserr Oct 27, 2024
fd4d732
Answer Entity.
EnesBaserr Oct 27, 2024
5386064
Merge pull request #442 from bounswe/backend/feature/438-create-answe…
EnesBaserr Oct 27, 2024
8e2c631
feat(backend): implement code execution service
atakanyasar Oct 27, 2024
165149a
Merge pull request #443 from bounswe/feature/439-execute-code
EnesBaserr Oct 28, 2024
5f748db
created queries to retrieve data for programming languages and paradigms
NazireAta Oct 28, 2024
26f4866
fixed the class declaration wrapper
NazireAta Oct 28, 2024
19cccf3
Implemented POST question upvote functionality.
EnesBaserr Oct 29, 2024
7a71ec9
Merge pull request #450 from bounswe/feature/backend/448-implement-po…
EnesBaserr Oct 29, 2024
4b6858c
Implemented POST question downvote functionality.
EnesBaserr Oct 29, 2024
7594b91
Merge pull request #451 from bounswe/backend/feature/449-implement-de…
EnesBaserr Oct 29, 2024
918bd69
Merge pull request #445 from bounswe/backend/feature/444-Create_SPARQ…
EnesBaserr Nov 2, 2024
664c625
Wikidata Service Impl
EnesBaserr Nov 2, 2024
38592dc
Merge pull request #458 from bounswe/backend/feature/455-implement-wi…
EnesBaserr Nov 2, 2024
a5e0f3c
GET tags/{tagId} endpoint
EnesBaserr Nov 2, 2024
fb172cd
Merge pull request #459 from bounswe/backend/feature/457-get-tagstagi…
EnesBaserr Nov 2, 2024
93c0f99
created queries to retrieve data for Computer Science Term and Softwa…
NazireAta Nov 2, 2024
813f33a
Merge pull request #463 from bounswe/backend/feature/461-Create_Queri…
EnesBaserr Nov 2, 2024
f3add50
Implement POST /questions
EnesBaserr Nov 2, 2024
a664ad6
Merge pull request #464 from bounswe/backend/feature/456-post-questio…
EnesBaserr Nov 2, 2024
db838cc
Implement POST /questions
EnesBaserr Nov 2, 2024
f4472ec
Merge pull request #466 from bounswe/backend/feature/465-implement-po…
EnesBaserr Nov 2, 2024
8075dca
Implement POST /tags.
EnesBaserr Nov 2, 2024
5cdc43c
Merge pull request #468 from bounswe/backend/feature/467-implement-po…
EnesBaserr Nov 2, 2024
fbef7c0
test commit
mmtftr Oct 20, 2024
9b7d5d1
create tag page, question page and fix layout
mmtftr Nov 3, 2024
39708dd
Merge branch 'develop' into 469-implement-delete-questionsquestionidd…
Cgtycolak Nov 3, 2024
9851a2a
Implement DELETE upvote and downvote
Cgtycolak Nov 3, 2024
f7e801e
.
mmtftr Nov 4, 2024
bb3e760
Merge pull request #471 from bounswe/469-implement-delete-questionsqu…
EnesBaserr Nov 4, 2024
ce38815
Merge pull request #473 from bounswe/mobile/feature/tag-question-page
mmtftr Nov 4, 2024
677acf7
Implement DELETE bookmark question
Cgtycolak Nov 4, 2024
10438f6
start lab PR
mmtftr Nov 5, 2024
fd75ad2
Add alt text for profile pictures for WCAG
ozdentarikcan Nov 5, 2024
36dafe0
add alt texts for tag logo image
asligook Nov 5, 2024
6a5e692
Add exercises to question page as a domain specific feature
atakanyasar Nov 5, 2024
204c7bf
fix linter error
atakanyasar Nov 5, 2024
648ca5d
adjusted colors to meet the contrast requirements of WCAG
NazireAta Nov 5, 2024
0df3f23
add tab support, add accessibility validation tests
mmtftr Nov 5, 2024
aaba3ba
Merge pull request #475 from bounswe/lab-3/pr
mmtftr Nov 5, 2024
3ece644
add experience and highlighted questions
mmtftr Nov 12, 2024
6f1b821
Experience level implemented and linked with User Entity.
EnesBaserr Nov 12, 2024
9bb992f
Related questions will be included in tag details response.
EnesBaserr Nov 12, 2024
3f16448
Implement highlighted questions in the Questions Page
ozdentarikcan Nov 12, 2024
9a266b6
Implement highligted questions in mobile
atakanyasar Nov 12, 2024
0f0d095
implement keyboard shortcuts, tooltips, copy code on mobile, experien…
mmtftr Nov 12, 2024
2717477
add copy-code button to the code snippets
asligook Nov 12, 2024
6740e70
add copy-code button to code snippets
asligook Nov 12, 2024
097d3bf
restore yarn.lock
mmtftr Nov 12, 2024
68a75b1
adjust mobile color theme to match frontend
mmtftr Nov 12, 2024
6c325e9
Merge pull request #498 from bounswe/lab-6/pr
mmtftr Nov 12, 2024
c9a07f1
feat(backend): implement vote answer api
atakanyasar Nov 15, 2024
17c233e
Merge pull request #509 from bounswe/feature/446-447-vote-answer
EnesBaserr Nov 16, 2024
8cbe1b6
Merge branch 'develop' into 472-implement-delete-questionsquestionidb…
Cgtycolak Nov 19, 2024
2262f1e
Fix path
Cgtycolak Nov 19, 2024
bd06fa0
Merge pull request #474 from bounswe/472-implement-delete-questionsqu…
EnesBaserr Nov 19, 2024
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
12 changes: 12 additions & 0 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
<artifactId>modelmapper</artifactId>
<version>3.2.1</version> <!-- Use the latest version -->
</dependency>
<!-- RDF4J Dependency -->
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-spring</artifactId>
<version>5.0.2</version>
</dependency>
<!-- RDF4J Dependency -->


<!-- For database & JPA dependencies -->
Expand Down Expand Up @@ -114,6 +121,11 @@
<version>5.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
package com.group1.programminglanguagesforum.Config;

import com.group1.programminglanguagesforum.DTOs.Responses.SelfProfileResponseDto;
import com.group1.programminglanguagesforum.DTOs.Responses.UserProfileResponseDto;
import com.group1.programminglanguagesforum.DTOs.Responses.*;
import com.group1.programminglanguagesforum.Entities.ProgrammingLanguagesTag;
import com.group1.programminglanguagesforum.Entities.ProgrammingParadigmTag;
import com.group1.programminglanguagesforum.Entities.Question;
import com.group1.programminglanguagesforum.Entities.User;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.text.SimpleDateFormat;

@Configuration
public class ModelMapperConfig {


@Bean
public ModelMapper modelMapper() {
ModelMapper modelMapper = new ModelMapper();


// Define a PropertyMap to skip certain fields
modelMapper.addMappings(new PropertyMap<SelfProfileResponseDto, User>() {
@Override
Expand All @@ -32,6 +39,39 @@ protected void configure() {

}
});
modelMapper.addMappings(new PropertyMap< GetQuestionWithTagDto,Question>() {
@Override
protected void configure() {
skip(destination.getTags());
skip(destination.getVotes());
skip(destination.getAskedBy());
}
});
modelMapper.addMappings(new PropertyMap<ProgrammingLanguagesTag, GetProgrammingLanguageTagResponseDto>() {
@Override
protected void configure() {
map(source.getId(), destination.getTagId());
map(source.getTagName(), destination.getName());
map(source.getTagDescription(), destination.getDescription());
map(source.getLogoImage(), destination.getLogoImage());
map(source.getAuthor(), destination.getAuthor());
map(source.getInceptionYear(), destination.getInceptionYear());
map(source.getFileExtension(), destination.getFileExtension());
map(source.getOfficialWebsite(), destination.getOfficialWebsite());
map(source.getStackExchangeTag(), destination.getStackExchangeTag());
}
});

// Map ProgrammingParadigmTag to GetProgrammingParadigmResponseDto
modelMapper.addMappings(new PropertyMap<ProgrammingParadigmTag, GetProgrammingParadigmResponseDto>() {
@Override
protected void configure() {
map(source.getId(), destination.getTagId());
map(source.getTagName(), destination.getName());
map(source.getTagDescription(), destination.getDescription());
map(source.getStackExchangeTag(), destination.getStackExchangeTag());
}
});

return modelMapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
Expand Down Expand Up @@ -36,14 +37,14 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws
httpSecurity.csrf(AbstractHttpConfigurer::disable)
.cors(cors -> cors.configurationSource(corsConfigurationSource))
.authorizeHttpRequests(
req -> req.requestMatchers("GET", API_BASE + EndpointConstants.UserEndpoints.USER_ME).authenticated() // Specific GET requests that need authentication
.requestMatchers("POST", API_BASE + EndpointConstants.AuthenticationEndpoints.SIGNUP).permitAll() // Permit signup without authentication
.requestMatchers("POST", API_BASE + EndpointConstants.AuthenticationEndpoints.SIGNIN).permitAll()
.requestMatchers("GET", API_BASE + EndpointConstants.TEST).permitAll()
.requestMatchers("POST", API_BASE + "/**").authenticated()// Permit signin without authentication// All POSTs need authentication
.requestMatchers("PUT", API_BASE + "/**").authenticated() // All PUTs need authentication
.requestMatchers("DELETE", API_BASE + "/**").authenticated()// All DELETEs need authentication
.requestMatchers("GET", "/**").permitAll() // General GET requests, allow everything else
req -> req.requestMatchers(HttpMethod.GET, API_BASE + EndpointConstants.UserEndpoints.USER_ME).authenticated() // Specific GET requests that need authentication
.requestMatchers(HttpMethod.POST, API_BASE + EndpointConstants.AuthenticationEndpoints.SIGNUP).permitAll() // Permit signup without authentication
.requestMatchers(HttpMethod.POST, API_BASE + EndpointConstants.AuthenticationEndpoints.SIGNIN).permitAll()
.requestMatchers(HttpMethod.GET, API_BASE + EndpointConstants.TEST).permitAll()
.requestMatchers(HttpMethod.POST, API_BASE + "/**").authenticated()// Permit signin without authentication// All POSTs need authentication
.requestMatchers(HttpMethod.PUT, API_BASE + "/**").authenticated() // All PUTs need authentication
.requestMatchers(HttpMethod.DELETE, API_BASE + "/**").authenticated()// All DELETEs need authentication
.requestMatchers(HttpMethod.GET, "/**").permitAll() // General GET requests, allow everything else
.anyRequest().authenticated()
)
.anonymous(anonymous -> anonymous.disable())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.group1.programminglanguagesforum.Constants;

import java.util.Map;

public class CodeExecutionConstants {

public static final String JUDGE0_API_URL = "https://judge0-ce.p.rapidapi.com";
public static final String JUDGE0_SUBMISSIONS_URL = JUDGE0_API_URL + "/submissions";
public static final String JUDGE0_API_KEY = "35e73d1355msh7eea11025c31207p1d0295jsn248174274d82";
public static Map<String, Integer> JUDGE0_LANGUAGE_IDS = Map.of(
"c", 50,
"c#", 51,
"cpp", 54,
"go", 60,
"java", 62,
"javascript", 63,
"python", 71
);

}

Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
package com.group1.programminglanguagesforum.Constants;

public class EndpointConstants {
public class EndpointConstants {

public static final String TEST = "/test";

public static class AuthenticationEndpoints {
public static final String BASE_PATH = "/auth";
public static final String BASE_PATH = "/auth";
public static final String SIGNIN = BASE_PATH + "/login";
public static final String SIGNUP = BASE_PATH +"/signup";
public static final String SIGNUP = BASE_PATH + "/signup";
}

public static class UserEndpoints {
public static final String BASE_PATH = "/users";
public static final String BASE_PATH = "/users";
public static final String USER_ME = BASE_PATH + "/me";
public static final String USER_ID = BASE_PATH + "/{id}";
public static final String USER_FOLLOW = BASE_PATH + "/{id}/follow";
public static final String USER_UNFOLLOW = BASE_PATH + "/{id}/unfollow";
public static final String USER_FOLLOWERS = BASE_PATH + "/{id}/followers";
}

public static class QuestionEndpoints {
public static final String BASE_PATH = "/questions";
public static final String QUESTION_ID = BASE_PATH + "/{id}";
public static final String QUESTION_UPVOTE = QUESTION_ID + "/upvote";
public static final String QUESTION_DOWNVOTE = QUESTION_ID + "/downvote";
public static final String QUESTION_DELETE_UPVOTE = QUESTION_ID + "/deleteUpvote";
public static final String QUESTION_DELETE_DOWNVOTE = QUESTION_ID + "/deleteDownvote";
}

public static class AnswerEndpoints {
public static final String BASE_PATH = "/answers";
public static final String ANSWER_ID = BASE_PATH + "/{id}";
public static final String ANSWER_UPVOTE = ANSWER_ID + "/upvote";
public static final String ANSWER_DOWNVOTE = ANSWER_ID + "/downvote";
}

public static class SparqlEndpoints {
public static final String BASE_PATH = "https://query.wikidata.org/sparql";
}

public static class TagEndpoints {
public static final String BASE_PATH = "/tags";
public static final String TAG_ID = BASE_PATH + "/{id}";
}

public static class BookmarkEndpoints {
public static final String BASE_PATH = "/questions/{questionId}/bookmarks";
public static final String BOOKMARK_DELETE = BASE_PATH;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
package com.group1.programminglanguagesforum.Constants;

public class GeneralConstants {
public static class SparqlConstants {
public static final String USER_AGENT = "Wikidata RDF4J Java Example/0.1 (https://query.wikidata.org/)";
public static final String SOFTWARE_LIBRARY_QUERY = """
SELECT DISTINCT ?library
(SAMPLE(?libraryLabel) AS ?libraryLabelS)\s
(SAMPLE(?description) AS ?descriptionS)\s
(SAMPLE(?logoImage) AS ?logoImageS)\s
(SAMPLE(?officialWebSite) AS ?officialWebSiteS)\s
(SAMPLE(?stackExchangeTag) AS ?stackExchangeTagS)
WHERE {
?library wdt:P31 wd:Q188860.

FILTER (
EXISTS { ?library wdt:P154 ?logoImage }
)
FILTER (
EXISTS { ?library wdt:P856 ?officialWebSite }
)

OPTIONAL { ?library wdt:P154 ?logoImage }
OPTIONAL { ?library wdt:P856 ?officialWebSite }
OPTIONAL { ?library wdt:P1482 ?stackExchangeTag }

OPTIONAL {
?library schema:description ?description.
FILTER((LANG(?description)) = "en")\s
}
OPTIONAL {
?library rdfs:label ?libraryLabel.
FILTER((LANG(?libraryLabel)) = "en")\s
}
}
GROUP BY ?library
HAVING (BOUND(?libraryLabelS))
""";

public static final String PROGRAMMING_PARADIGM_QUERY = """
SELECT DISTINCT ?paradigm\s
(SAMPLE(?paradigmLabel) AS ?paradigmLabelS)\s
(SAMPLE(?description) AS ?descriptionS)\s
(SAMPLE(?stackExchangeTag) AS ?stackExchangeTagS)

WHERE {
?paradigm wdt:P31 wd:Q188267.

OPTIONAL {
?paradigm schema:description ?description.
FILTER((LANG(?description)) = "en")\s
}

OPTIONAL {
?paradigm rdfs:label ?paradigmLabel.
FILTER((LANG(?paradigmLabel)) = "en")\s
}

OPTIONAL {
?paradigm wdt:P1482 ?stackExchangeTag.\s
}
}
GROUP BY ?paradigm
HAVING (BOUND(?paradigmLabelS))\
""";
public static final String COMPUTER_SCIENCE_TERM_QUERY = """
SELECT DISTINCT ?term\s
(SAMPLE(?termLabel) AS ?termLabelS)\s
(SAMPLE(?description) AS ?descriptionS)\s
(SAMPLE(?stackExchangeTag) AS ?stackExchangeTagS)

WHERE {
?term wdt:P31 wd:Q66747126.

OPTIONAL {
?term schema:description ?description.
FILTER((LANG(?description)) = "en")\s
}

OPTIONAL {
?term rdfs:label ?termLabel.
FILTER((LANG(?termLabel)) = "en")\s
}

OPTIONAL {
?term wdt:P1482 ?stackExchangeTag.\s
}
}
GROUP BY ?term
HAVING (BOUND(?termLabelS))\
""";
public static final String PROGRAMMING_LANGUAGES_QUERY =
"""
SELECT DISTINCT ?language\s
(SAMPLE(?languageLabel) AS ?languageLabelS)\s
(SAMPLE(?description) AS ?descriptionS)\s
(SAMPLE(?logoImage) AS ?logoImageS)
(SAMPLE(?authorLabel) AS ?authorS)
(SAMPLE(?inceptionYear) AS ?inceptionYearS)
(SAMPLE(?fileExtension) AS ?fileExtensionS)
(SAMPLE(?officialWebSite) AS ?officialWebSiteS)
(SAMPLE(?stackExchangeTag) AS ?stackExchangeTagS)
WHERE {
{
?language wdt:P31 wd:Q9143. # programming language
}
UNION
{
?language wdt:P31 wd:Q12772052. # scripting language
}
UNION
{
?language wdt:P31 wd:Q899523. # object-based language
}
\s
FILTER (
EXISTS { ?language wdt:P154 ?logoImage }\s
)
FILTER (
EXISTS { ?language wdt:P856 ?officialWebSite }\s
)

OPTIONAL { ?language wdt:P154 ?logoImage }
OPTIONAL { ?language wdt:P856 ?officialWebSite }
OPTIONAL { ?language wdt:P1482 ?stackExchangeTag }

OPTIONAL {
?language schema:description ?description.
FILTER((LANG(?description)) = "en")
}
\s
OPTIONAL {
?language rdfs:label ?languageLabel.
FILTER((LANG(?languageLabel)) = "en")
}

OPTIONAL {
?language wdt:P178 ?author.
?author rdfs:label ?authorLabel.
FILTER((LANG(?authorLabel)) = "en")
}
\s
OPTIONAL { ?language wdt:P571 ?inceptionYear }
\s
OPTIONAL { ?language wdt:P1195 ?fileExtension }
}
GROUP BY ?language
HAVING (BOUND(?languageLabelS))
""";
}
}
Loading