Skip to content

Commit

Permalink
fe and be changes. Change application. (#32)
Browse files Browse the repository at this point in the history
* changed fe test from karma to jest, because of headless chrome and speed, also faster and better coverage. And added httpService with httpClient for be calls
  • Loading branch information
MocStepan authored Apr 7, 2024
1 parent c787f5c commit 438624c
Show file tree
Hide file tree
Showing 32 changed files with 7,527 additions and 3,780 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
run: npm run build

- name: Run tests
run: npm run test:ci
run: npm run test

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: frontend
file: frontend/coverage/lcov-report/lcov.info
file: frontend/coverage/cobertura-coverage.xml
3 changes: 3 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ out/

### Kotlin ###
.kotlin

### custom ###
config/application.yml
19 changes: 19 additions & 0 deletions backend/config/application-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
spring:
profiles:
active: [ localDev ]

---
spring:
config:
activate:
on-profile: localDev
datasource:
url: jdbc:postgresql://localhost:5432/stin
username: postgres
password: postgres
security:
basic:
enabled: false
user:
name: admin
password: admin
17 changes: 17 additions & 0 deletions backend/config/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
spring:
profiles:
active: [ localDev ]

---
spring:
config:
activate:
on-profile: localDev
datasource:
url: jdbc:postgresql://localhost:5432/stin
username: postgres
password: Mozart987321x
security:
user:
name: admin
password: admin
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.tul.backend.auth.base


import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
import org.springframework.security.config.web.server.ServerHttpSecurity
import org.springframework.security.web.server.SecurityWebFilterChain
import org.springframework.security.core.userdetails.MapReactiveUserDetailsService
import org.springframework.security.core.userdetails.User


@Configuration
@EnableWebFluxSecurity
class SecurityConfig {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.tul.backend.weather.controller

import com.tul.backend.weather.service.WeatherService
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
Expand All @@ -14,9 +15,9 @@ class WeatherController(


@GetMapping("/actual-weather")
fun getActualWeather() {
fun getActualWeather(): ResponseEntity<String?> {
val response = weatherService.getActualWeather()
val status = if (response != null) HttpStatus.OK else HttpStatus.NOT_FOUND
// return ResponseEntity(response, status)
return ResponseEntity(response, status)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import org.springframework.stereotype.Service
class WeatherService {
fun getActualWeather(): String? {

return null
return "ahoj"
}
}
1 change: 0 additions & 1 deletion backend/src/main/resources/application.properties

This file was deleted.

19 changes: 19 additions & 0 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server:
port: 8080

spring:
application:
name: backend
datasource:
driverClassName: org.postgresql.Driver
jpa:
open-in-view: false
properties:
hibernate:
jdbc.lob.non_contextual_creation: true # for postgresql
dialect: org.hibernate.dialect.PostgreSQLDialect
use_nationalized_character_data: true
temp:
use_jdbc_metadata_defaults: false
show_sql: false
default_schema: public
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ yarn-error.log
/libpeerconnection.log
testem.log
/typings
junit.xml
/.jestcache

# System files
.DS_Store
Expand Down
19 changes: 0 additions & 19 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,6 @@
"options": {
"buildTarget": "frontend:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"karmaConfig": "karma.conf.js",
"tsConfig": "tsconfig.spec.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions frontend/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Config} from 'jest';

const jestConfig: Config = {

preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
globalSetup: 'jest-preset-angular/global-setup',
reporters: [
'default',
],
collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**'],
coverageDirectory: 'coverage',
coverageReporters: ['cobertura', 'text', 'text-summary', 'html'],
cacheDirectory: '.jestcache'
};

export default jestConfig;
46 changes: 0 additions & 46 deletions frontend/karma.conf.js

This file was deleted.

Loading

0 comments on commit 438624c

Please sign in to comment.