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

DevTwo #1

Open
wants to merge 2 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
15 changes: 15 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>



<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>

</dependencies>

<build>
Expand Down
16 changes: 16 additions & 0 deletions api/src/main/java/kodlamaio/hrms/HrmsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableSwagger2
public class HrmsApplication {

public static void main(String[] args) {
SpringApplication.run(HrmsApplication.class, args);
}


@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("kodlamaio.hrms"))
.build();
}

}
21 changes: 21 additions & 0 deletions api/src/main/java/kodlamaio/hrms/Services/Mernis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package kodlamaio.hrms.Services;

import kodlamaio.hrms.core.utilities.results.DataResult;

import kodlamaio.hrms.core.utilities.results.ErrorDataResult;
import kodlamaio.hrms.core.utilities.results.SuccessDataResult;
import kodlamaio.hrms.entities.concretes.Jobseeker;

public class Mernis {

public static DataResult<Jobseeker> Validate(Jobseeker jobseeker) {

if(jobseeker.getTcNo().length() != 11) {
return new ErrorDataResult<Jobseeker>("Tc kimlik numarası hatalı!");
}

return new SuccessDataResult<Jobseeker>("Mernis doğrulaması başarılı!");
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package kodlamaio.hrms.api.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import kodlamaio.hrms.business.abstracts.EmployerService;
import kodlamaio.hrms.core.utilities.results.DataResult;
import kodlamaio.hrms.core.utilities.results.Result;
import kodlamaio.hrms.entities.concretes.Employer;

@RestController
@RequestMapping("/api/employers")
public class EmployerController {
private EmployerService employerService;

@Autowired
public EmployerController(EmployerService employerService) {
super();
this.employerService = employerService;
}

@GetMapping("/getAllEmployer")
public DataResult<List<Employer>> getAll() {
return this.employerService.getAll();
}


@PostMapping("/add")
public Result add(@RequestBody Employer employer) {
return this.employerService.add(employer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import kodlamaio.hrms.business.abstracts.JobPositionService;
import kodlamaio.hrms.core.utilities.results.DataResult;
import kodlamaio.hrms.core.utilities.results.Result;
import kodlamaio.hrms.entities.concretes.JobPosition;

@RestController
Expand All @@ -22,12 +26,13 @@ public JobPositionController(JobPositionService jobPositionService) {
}

@GetMapping("/getAllJobs")
public List<JobPosition> getAll() {
public DataResult<List<JobPosition>> getAll() {
return this.jobPositionService.getAll();
}

@GetMapping("/get")
public long get() {
return this.jobPositionService.test();

@PostMapping("/add")
public Result add(@RequestBody JobPosition jobPosition) {
return this.jobPositionService.add(jobPosition);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package kodlamaio.hrms.api.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import kodlamaio.hrms.business.abstracts.JobseekerService;
import kodlamaio.hrms.core.utilities.results.DataResult;
import kodlamaio.hrms.core.utilities.results.Result;
import kodlamaio.hrms.entities.concretes.Jobseeker;

@RestController
@RequestMapping("/api/jobseekers")
public class JobseekerController {
private JobseekerService jobseekerService;

@Autowired
public JobseekerController(JobseekerService jobseekerService) {
super();
this.jobseekerService = jobseekerService;
}

@GetMapping("/getAllJobseekers")
public DataResult<List<Jobseeker>> getAll() {
return this.jobseekerService.getAll();
}


@PostMapping("/add")
public Result add(@RequestBody Jobseeker jobseeker) {
return this.jobseekerService.add(jobseeker);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package kodlamaio.hrms.api.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import kodlamaio.hrms.business.abstracts.PersonelService;
import kodlamaio.hrms.core.utilities.results.DataResult;
import kodlamaio.hrms.core.utilities.results.Result;
import kodlamaio.hrms.entities.concretes.Personel;

@RestController
@RequestMapping("/api/personels")
public class PersonelController {
private PersonelService personelService;

@Autowired
public PersonelController(PersonelService personelService) {
super();
this.personelService = personelService;
}

@GetMapping("/getAllUsers")
public DataResult<List<Personel>> getAll() {
return this.personelService.getAll();
}


@PostMapping("/add")
public Result add(@RequestBody Personel personel) {
return this.personelService.add(personel);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package kodlamaio.hrms.api.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import kodlamaio.hrms.business.abstracts.UserService;
import kodlamaio.hrms.core.utilities.results.DataResult;
import kodlamaio.hrms.entities.concretes.User;
import kodlamaio.hrms.core.utilities.results.Result;

@RestController
@RequestMapping("/api/users")
public class UserController {
private UserService userService;

@Autowired
public UserController(UserService userService) {
super();
this.userService = userService;
}

@GetMapping("/getAllUsers")
public DataResult<List<User>> getAll() {
return this.userService.getAll();
}

@PostMapping("/verify")
public Result Verify(int userId, String verifyCode) {
return this.userService.Verify(userId, verifyCode);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package kodlamaio.hrms.business.abstracts;

import java.util.List;

import kodlamaio.hrms.core.utilities.results.DataResult;

import kodlamaio.hrms.core.utilities.results.Result;
public interface BaseService<T> {
public DataResult<List<T>> getAll();
public Result add(T entity);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package kodlamaio.hrms.business.abstracts;

import kodlamaio.hrms.entities.concretes.Employer;

public interface EmployerService extends BaseService<Employer>{

}


Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
package kodlamaio.hrms.business.abstracts;

import java.util.List;

import kodlamaio.hrms.entities.concretes.JobPosition;

public interface JobPositionService {
List<JobPosition> getAll();

long test();

public interface JobPositionService extends BaseService<JobPosition>{
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package kodlamaio.hrms.business.abstracts;

import kodlamaio.hrms.entities.concretes.Jobseeker;

public interface JobseekerService extends BaseService<Jobseeker>{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package kodlamaio.hrms.business.abstracts;

import kodlamaio.hrms.entities.concretes.Personel;

public interface PersonelService extends BaseService<Personel>{

}


Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package kodlamaio.hrms.business.abstracts;

import kodlamaio.hrms.entities.concretes.UserRegister;

public interface UserRegisterService extends BaseService<UserRegister>{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package kodlamaio.hrms.business.abstracts;

import kodlamaio.hrms.core.utilities.results.Result;
import kodlamaio.hrms.entities.concretes.User;

public interface UserService extends BaseService<User>{
public Result Verify(int userId, String code);
}
Loading