Skip to content
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
with:
arguments: test
- name: Upload coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./server/build/reports/jacoco/test/jacocoTestReport.xml
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1 align="center">CodeCharacter Server 2022</h1>
<h1 align="center">CodeCharacter Server 2023</h1>

<p align="center">
<a href="https://github.com/delta/codecharacter-server-2022/actions/workflows/ci.yml">
Expand All @@ -20,10 +20,12 @@
### Setup

1. Clone the repo and open in IntelliJ Ultimate.
2. Press `Ctrl+Alt+Shift+S` and make sure the JDK version is 17.
3. Press `Ctrl+Alt+S` and go to `Build, Execution, Deployment -> Docker` and make sure docker is configured correctly/
4. Copy `server/src/main/resources/application.example.yml` to `server/src/main/resources/application.yml`. If you want to use docker instead, copy the `server/src/main/resources/application.docker.example.yml` to `server/src/main/resources/application.yml`.
5. The run configurations will be available in the top bar:
2. From the project root directory,run ```./gradlew installGitHooks``` to install git-hooks
3. Press `Ctrl+Alt+Shift+S` and make sure the JDK version is 17.
4. Press `Ctrl+Alt+S` and go to `Build, Execution, Deployment -> Docker` and make sure docker is configured correctly/
5. Copy `server/src/main/resources/application.example.yml` to `server/src/main/resources/application.yml`. If you want to use docker instead, copy the `server/src/main/resources/application.docker.example.yml` to `server/src/main/resources/application.yml`.
6. The run configurations will be available in the top bar:

![Run Configurations](https://i.imgur.com/pO2SrPd.png)

### Run Configurations
Expand Down
124 changes: 124 additions & 0 deletions docs/spec/CodeCharacter-API.yml
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ paths:
college: NITT
avatarId: 1
isProfileComplete: true
isTutorialComplete: true
'401':
description: Unauthorized
operationId: getCurrentUser
Expand Down Expand Up @@ -564,6 +565,7 @@ paths:
name: Test User Mofified
country: IN
college: NIT Trichy
tutorialLevel: 1
tags:
- current-user
/user/complete-profile:
Expand Down Expand Up @@ -629,6 +631,30 @@ paths:
oldPassword: Pa$$w0rd
password: Pa$$w0rd1
passwordConfirmation: Pa$$w0rd1
/user/tutorial/level:
get:
summary: Get Tutorial level of the user
description: Get the tutorial level of the user
operationId: getTutorialLevel
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TutorialLevelResponse'
examples:
Example:
value:
level: 2
403:
description: Forbidden
401:
description: Unauthorized
404:
description: Not Found
tags:
- current-user
/user/code/latest:
get:
summary: Get latest code
Expand Down Expand Up @@ -1064,6 +1090,7 @@ paths:
country: IN
college: NITT
avatarId: 0
recaptchaCode: 03AD1IbLAGl_UdwYP3-AeibnfJgXy_g3cNr_rhkBBh4zalD9GEXAR2xCcUGi7WlxFgOjYlpbRpZFTJJDVugJF-H4pBl32DU619cYHplp_ReGiOokgvz8DwiRLIZBvg1eu2e77jihWQPndoWU_WOTKrYVq1mzBcdPUfJ3PEMCo-eGvoyRaNvRWE0JYBSBgDfwFBaw8RmxaqiS84or-_G7-TDiifFYpcNFiIolIjGi9DkbMXivkjiIoEomAz6NUHg0alrk0C5_p1maoErBmpwLGwlAgKL_sa-ZAzHb89OprdVI8BXtN0CATBgwYO6u_zqrK5N9wDQyh-OmtFh5RXkEzmkASls33UYcJrtMfeFU-b9N-u-Je6NXVfkX49gAGan3k-GqkgcFKHowc5Cwym9tlGLrfiBtqKLIADw1UX4BCbIx9BbHlesoKEubr7MoVZCDv3VfctSTMXG-oH5IbDRQhez4E6JHR4Uv0lWyHKROv7wdxqXauz5PBlUlE11BdffXU5NEssJkM4Tk3zg5k6ddkju8DU2keqXodnzXVTBIXC6zxriA8IHaS_KFBtazAYZ6oac3-5Y2VMwli3XaADBCCVJzXC0GTa1jeuZQ
description: ''
security: []
'/users/{userId}/activate':
Expand Down Expand Up @@ -1128,6 +1155,49 @@ paths:
description: Not Found
operationId: getRatingHistory
description: Get user rating history

'/dc/get':
get:
summary: Get Daily Challenge for the day
description: Get current user challenge for that day
operationId: getDailyChallenge
tags:
- Daily Challenges
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DailyChallengeGetRequest'
401:
description: Unauthorized
403:
description: Forbidden
404:
description: Not found
'/dc/leaderboard':
get:
summary: Get Daily Challenges Leaderboard
description: Get Leaderboard for daily challenges
operationId: getDailyChallengeLeaderBoard
tags:
- Daily Challenges
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DailyChallengeLeaderBoardResponse'
'401':
description: Unauthorized
'403':
description: Forbidden
'404':
description: Not Found
components:
schemas:
PasswordLoginRequest:
Expand Down Expand Up @@ -1516,6 +1586,9 @@ components:
isProfileComplete:
type: boolean
default: false
isTutorialComplete:
type: boolean
default: false
required:
- id
- username
Expand All @@ -1525,6 +1598,7 @@ components:
- college
- avatarId
- isProfileComplete
- isTutorialComplete
UpdateCurrentUserProfile:
title: UpdateCurrentUserProfile
type: object
Expand All @@ -1546,6 +1620,10 @@ components:
type: integer
example: 1
nullable: true
tutorialLevel:
type: integer
example: 2
nullable: true
CompleteProfileRequest:
title: CompleteProfileRequest
type: object
Expand Down Expand Up @@ -1609,6 +1687,9 @@ components:
avatarId:
type: integer
example: 1
recaptchaCode:
type: string
example: 03AD1IbLAGl_UdwYP3-AeibnfJgXy_g3cNr_rhkBBh4zalD9GEXAR2xCcUGi7WlxFgOjYlpbRpZFTJJDVugJF-H4pBl32DU619cYHplp_ReGiOokgvz8DwiRLIZBvg1eu2e77jihWQPndoWU_WOTKrYVq1mzBcdPUfJ3PEMCo-eGvoyRaNvRWE0JYBSBgDfwFBaw8RmxaqiS84or-_G7-TDiifFYpcNFiIolIjGi9DkbMXivkjiIoEomAz6NUHg0alrk0C5_p1maoErBmpwLGwlAgKL_sa-ZAzHb89OprdVI8BXtN0CATBgwYO6u_zqrK5N9wDQyh-OmtFh5RXkEzmkASls33UYcJrtMfeFU-b9N-u-Je6NXVfkX49gAGan3k-GqkgcFKHowc5Cwym9tlGLrfiBtqKLIADw1UX4BCbIx9BbHlesoKEubr7MoVZCDv3VfctSTMXG-oH5IbDRQhez4E6JHR4Uv0lWyHKROv7wdxqXauz5PBlUlE11BdffXU5NEssJkM4Tk3zg5k6ddkju8DU2keqXodnzXVTBIXC6zxriA8IHaS_KFBtazAYZ6oac3-5Y2VMwli3XaADBCCVJzXC0GTa1jeuZQ
required:
- username
- name
Expand All @@ -1618,6 +1699,7 @@ components:
- country
- college
- avatarId
- recaptchaCode
Match:
description: Match model
type: object
Expand Down Expand Up @@ -1718,6 +1800,42 @@ components:
- user
- stats
description: Leaderboard entry model
DailyChallengeGetRequest:
title: Get daily challenge
description: Get current-user daily challenge
type: object
properties:
challName:
type: string
example: Daily Challenge 1
chall:
type: string
example: 'print("hello world");'
challType:
$ref: '#/components/schemas/ChallengeType'
required:
- challName
- chall
- challType
DailyChallengeLeaderBoardResponse:
title: DailyChallengeLeaderboardResponse
description: Response model for daily challenge leaderboard
type: object
properties:
userName:
type: string
example: TestUser
score:
type: string
example: 1500.0
TutorialLevelResponse:
title: TutorialLevelResponse
description: Get the tutorial level of the current user
type: object
properties:
level:
type: integer
example: 2
GenericError:
title: GenericError
type: object
Expand Down Expand Up @@ -1771,6 +1889,12 @@ components:
- AUTHENTICATED
- PROFILE_INCOMPLETE
- ACTIVATION_PENDING
ChallengeType:
title: DailyChallengeTypes
type: string
enum:
- CODE
- MAP
securitySchemes:
oauth2-google:
type: oauth2
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions library/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
src/main/kotlin/delta/codecharacter/SpringDocConfiguration.kt
src/main/kotlin/delta/codecharacter/core/AuthApi.kt
src/main/kotlin/delta/codecharacter/core/CodeApi.kt
src/main/kotlin/delta/codecharacter/core/CurrentUserApi.kt
src/main/kotlin/delta/codecharacter/core/DailyChallengesApi.kt
src/main/kotlin/delta/codecharacter/core/GameApi.kt
src/main/kotlin/delta/codecharacter/core/LeaderboardApi.kt
src/main/kotlin/delta/codecharacter/core/MapApi.kt
Expand All @@ -9,13 +11,16 @@ src/main/kotlin/delta/codecharacter/core/NotificationApi.kt
src/main/kotlin/delta/codecharacter/core/UserApi.kt
src/main/kotlin/delta/codecharacter/dtos/ActivateUserRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/AuthStatusResponseDto.kt
src/main/kotlin/delta/codecharacter/dtos/ChallengeTypeDto.kt
src/main/kotlin/delta/codecharacter/dtos/CodeDto.kt
src/main/kotlin/delta/codecharacter/dtos/CodeRevisionDto.kt
src/main/kotlin/delta/codecharacter/dtos/CompleteProfileRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/CreateCodeRevisionRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/CreateMapRevisionRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/CreateMatchRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/CurrentUserProfileDto.kt
src/main/kotlin/delta/codecharacter/dtos/DailyChallengeGetRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/DailyChallengeLeaderBoardResponseDto.kt
src/main/kotlin/delta/codecharacter/dtos/ForgotPasswordRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/GameDto.kt
src/main/kotlin/delta/codecharacter/dtos/GameMapDto.kt
Expand All @@ -33,6 +38,7 @@ src/main/kotlin/delta/codecharacter/dtos/PublicUserDto.kt
src/main/kotlin/delta/codecharacter/dtos/RatingHistoryDto.kt
src/main/kotlin/delta/codecharacter/dtos/RegisterUserRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/ResetPasswordRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/TutorialLevelResponseDto.kt
src/main/kotlin/delta/codecharacter/dtos/UpdateCurrentUserProfileDto.kt
src/main/kotlin/delta/codecharacter/dtos/UpdateLatestCodeRequestDto.kt
src/main/kotlin/delta/codecharacter/dtos/UpdateLatestMapRequestDto.kt
Expand Down
2 changes: 1 addition & 1 deletion library/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.1
6.2.1
22 changes: 12 additions & 10 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tasks.withType<KotlinCompile> {
}

plugins {
id("org.springframework.boot") version "2.6.2" apply false
id("org.springframework.boot") version "3.0.0" apply false
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm")
kotlin("plugin.jpa")
Expand All @@ -31,17 +31,19 @@ dependencyManagement {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.0")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.0")
implementation("org.springframework.boot:spring-boot-starter-validation:2.6.3")
implementation("org.springframework.boot:spring-boot-starter-web:2.6.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt")
implementation("io.swagger:swagger-annotations:1.6.4")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.1")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.1")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.1")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1")
implementation("org.springframework.boot:spring-boot-starter-validation:3.0.0")
implementation("org.springframework.boot:spring-boot-starter-web:3.0.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("jakarta.annotation:jakarta.annotation-api:2.1.1")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.0")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.0")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.0")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.0")
implementation("io.swagger.core.v3:swagger-annotations:2.2.7")
implementation("io.swagger.core.v3:swagger-core:2.2.7")

testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:1.6.0")
testImplementation("org.springframework.boot:spring-boot-starter-test:2.6.3") {
testImplementation("org.springframework.boot:spring-boot-starter-test:3.0.0") {
exclude(module = "junit")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package delta.codecharacter

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

import io.swagger.v3.oas.models.OpenAPI
import io.swagger.v3.oas.models.info.Info
import io.swagger.v3.oas.models.info.Contact
import io.swagger.v3.oas.models.info.License
import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.security.SecurityScheme

@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
@Configuration
class SpringDocConfiguration {

@Bean
fun apiInfo(): OpenAPI {
return OpenAPI()
.info(
Info()
.title("CodeCharacter API")
.description("Specification of the CodeCharacter API")
.contact(
Contact()
.name("CodeCharacter Authors")
.url("https://delta.nitt.edu")
.email("delta@nitt.edu")
)
.license(
License()
.name("MIT")
)
.version("2022.0.1")
)
.components(
Components()
.addSecuritySchemes("http-bearer", SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
)
.addSecuritySchemes("oauth2-github", SecurityScheme()
.type(SecurityScheme.Type.OAUTH2)
)
.addSecuritySchemes("oauth2-google", SecurityScheme()
.type(SecurityScheme.Type.OAUTH2)
)
)
}
}
Loading