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

Clean up cruft and basic file logging setup #69

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ build/

### Logs ###
*.log
logs/*

### maven ###
.mvn/
.mvn/
20 changes: 17 additions & 3 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
start:
.PHONY: run start_db reset_db clean_db clean

# I would put db as a target prereq but the script assumes the database does not exist
run:
# NOTE: Requires DB to be initialized (start_db).
mvn spring-boot:run

reset:
sudo mariadb -e "DROP DATABASE casa;"; sudo mariadb -e "CREATE DATABASE casa;"
start_db:
# Run the postStartCommand.sh script which initializes/starts mariadb
bash ../.devcontainer/postStartCommand.sh

reset_db: clean_db
sudo mariadb -e "CREATE DATABASE casa;"

clean_db:
sudo mariadb -e "DROP DATABASE casa;"

clean: clean_db
rm -rf logs
8 changes: 2 additions & 6 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
Expand Down Expand Up @@ -101,11 +102,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package com.example.casa;
package com.casa;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import com.example.casa.Config.AppProperties;
import com.casa.Config.AppProperties;

import lombok.extern.slf4j.Slf4j;

@SpringBootApplication
@EntityScan("com.example.casa.Model")
@EnableJpaRepositories("com.example.casa.Repository")
@EntityScan("com.casa.Model")
@EnableJpaRepositories("com.casa.Repository")
@EnableConfigurationProperties(AppProperties.class)
@Slf4j
public class CasaApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Config;
package com.casa.Config;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Config;
package com.casa.Config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Config;
package com.casa.Config;

import java.util.Properties;

Expand All @@ -7,7 +7,7 @@
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import com.example.casa.Payload.EmailDetails;
import com.casa.Payload.EmailDetails;


@Configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Config;
package com.casa.Config;

import java.util.Arrays;
import java.util.Collections;
Expand All @@ -23,11 +23,11 @@
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import com.example.casa.Security.OAuth.CustomOAuth2UserService;
import com.example.casa.Security.OAuth.HttpCookieOAuth2AuthorizationRequestRepository;
import com.example.casa.Security.OAuth.OAuth2AuthenticationFailureHandler;
import com.example.casa.Security.OAuth.OAuth2AuthenticationSuccessHandler;
import com.example.casa.Security.TokenAuthenticationFilter;
import com.casa.Security.OAuth.CustomOAuth2UserService;
import com.casa.Security.OAuth.HttpCookieOAuth2AuthorizationRequestRepository;
import com.casa.Security.OAuth.OAuth2AuthenticationFailureHandler;
import com.casa.Security.OAuth.OAuth2AuthenticationSuccessHandler;
import com.casa.Security.TokenAuthenticationFilter;

import lombok.RequiredArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Controller;
package com.casa.Controller;

import java.net.URI;

Expand All @@ -21,14 +21,14 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import com.example.casa.Model.AuthProvider;
import com.example.casa.Model.User;
import com.example.casa.Payload.ApiResponse;
import com.example.casa.Payload.User.AuthResponse;
import com.example.casa.Payload.User.LoginRequest;
import com.example.casa.Payload.User.SignUpRequest;
import com.example.casa.Repository.UserRepository;
import com.example.casa.Security.TokenProvider;
import com.casa.Model.AuthProvider;
import com.casa.Model.User;
import com.casa.Payload.ApiResponse;
import com.casa.Payload.User.AuthResponse;
import com.casa.Payload.User.LoginRequest;
import com.casa.Payload.User.SignUpRequest;
import com.casa.Repository.UserRepository;
import com.casa.Security.TokenProvider;

import jakarta.validation.Valid;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Controller;
package com.casa.Controller;

import java.util.Calendar;
import java.util.Date;
Expand All @@ -15,17 +15,17 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.casa.Exception.BadRequestException;
import com.example.casa.Model.Event;
import com.example.casa.Model.Organization;
import com.example.casa.Model.User;
import com.example.casa.Payload.ApiResponse;
import com.example.casa.Payload.Event.CalendarResponse;
import com.example.casa.Payload.Event.EventDto;
import com.example.casa.Repository.EventRepository;
import com.example.casa.Repository.OrganizationRepository;
import com.example.casa.Repository.UserRepository;
import com.example.casa.Util.DateConverter;
import com.casa.Exception.BadRequestException;
import com.casa.Model.Event;
import com.casa.Model.Organization;
import com.casa.Model.User;
import com.casa.Payload.ApiResponse;
import com.casa.Payload.Event.CalendarResponse;
import com.casa.Payload.Event.EventDto;
import com.casa.Repository.EventRepository;
import com.casa.Repository.OrganizationRepository;
import com.casa.Repository.UserRepository;
import com.casa.Util.DateConverter;

@RestController
public class EventController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Controller;
package com.casa.Controller;

import java.util.HashSet;
import java.util.Set;
Expand All @@ -11,15 +11,15 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.casa.Model.Organization;
import com.example.casa.Model.Role;
import com.example.casa.Model.User;
import com.example.casa.Payload.ApiResponse;
import com.example.casa.Payload.Organization.OrganizationDto;
import com.example.casa.Payload.Organization.OrganizationWithRoles;
import com.example.casa.Repository.EventRepository;
import com.example.casa.Repository.OrganizationRepository;
import com.example.casa.Repository.UserRepository;
import com.casa.Model.Organization;
import com.casa.Model.Role;
import com.casa.Model.User;
import com.casa.Payload.ApiResponse;
import com.casa.Payload.Organization.OrganizationDto;
import com.casa.Payload.Organization.OrganizationWithRoles;
import com.casa.Repository.EventRepository;
import com.casa.Repository.OrganizationRepository;
import com.casa.Repository.UserRepository;

@RestController
public class OrganizationController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Controller;
package com.casa.Controller;

import java.util.Set;

Expand All @@ -9,13 +9,13 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.example.casa.Model.Organization;
import com.example.casa.Model.Role;
import com.example.casa.Model.User;
import com.example.casa.Payload.Role.RoleDto;
import com.example.casa.Repository.OrganizationRepository;
import com.example.casa.Repository.RoleRepository;
import com.example.casa.Repository.UserRepository;
import com.casa.Model.Organization;
import com.casa.Model.Role;
import com.casa.Model.User;
import com.casa.Payload.Role.RoleDto;
import com.casa.Repository.OrganizationRepository;
import com.casa.Repository.RoleRepository;
import com.casa.Repository.UserRepository;

@RestController
public class RoleController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.example.casa.Controller;
package com.casa.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.casa.Exception.ResourceNotFoundException;
import com.example.casa.Model.User;
import com.example.casa.Repository.UserRepository;
import com.example.casa.Security.CurrentUser;
import com.example.casa.Security.UserPrincipal;
import com.casa.Exception.ResourceNotFoundException;
import com.casa.Model.User;
import com.casa.Repository.UserRepository;
import com.casa.Security.CurrentUser;
import com.casa.Security.UserPrincipal;

@RestController
public class UserController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Exception;
package com.casa.Exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Exception;
package com.casa.Exception;

import org.springframework.security.core.AuthenticationException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Exception;
package com.casa.Exception;

import lombok.Data;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Model;
package com.casa.Model;

public enum AuthProvider {
google, local
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Model;
package com.casa.Model;

import java.util.Date;
import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Model;
package com.casa.Model;

import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Model;
package com.casa.Model;

import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Model;
package com.casa.Model;

import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload;
package com.casa.Payload;

public class ApiResponse {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload;
package com.casa.Payload;

import org.springframework.web.multipart.MultipartFile;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.example.casa.Payload.Event;
package com.casa.Payload.Event;

import java.util.Set;

import com.example.casa.Model.Event;
import com.casa.Model.Event;

public class CalendarResponse {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload.Event;
package com.casa.Payload.Event;

public class EventDto {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload.Organization;
package com.casa.Payload.Organization;

public class OrganizationDto {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.example.casa.Payload.Organization;
package com.casa.Payload.Organization;

import java.util.HashSet;
import java.util.Set;

import com.example.casa.Model.Organization;
import com.example.casa.Model.Role;
import com.example.casa.Model.User;
import com.casa.Model.Organization;
import com.casa.Model.Role;
import com.casa.Model.User;

public class OrganizationWithRoles extends Organization {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload.Role;
package com.casa.Payload.Role;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload.User;
package com.casa.Payload.User;

public class AuthResponse {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload.User;
package com.casa.Payload.User;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.casa.Payload.User;
package com.casa.Payload.User;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
Expand Down
Loading
Loading