Skip to content

Commit

Permalink
Companyservice eklendi
Browse files Browse the repository at this point in the history
  • Loading branch information
seydamersin committed Feb 19, 2023
1 parent d78c775 commit 5c2710c
Show file tree
Hide file tree
Showing 50 changed files with 866 additions and 38 deletions.
Binary file modified .gradle/7.5.1/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/7.5.1/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/checksums/sha1-checksums.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.5.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.
7 changes: 5 additions & 2 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules/mail-service/HRMP.mail-service.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Projede İK çalışanı (yönetici) ve personel rolleri bulunmaktadır.
## Authors
* Barış Mert Cömertoğlu
* Yiğit Aral Yücepur
* Şelçuk Durukan
* Selçuk Durukan
* Şeyda Mersin
* Barış Yücetürk
9 changes: 9 additions & 0 deletions api-gateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
spring:
cloud:
config:
uri: http://10.124.11.103:8888
# uri: http://localhost:8888
config:
import: "configserver:"
application:
name: api-gateway-application
1 change: 1 addition & 0 deletions auth-microservice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dependencies {
implementation libs.postgreSQL
implementation libs.springCloudConfigClient
implementation libs.springBootStarterSecurity
implementation libs.springBootStarterAmqp
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.bilgeadam.dto.request.RegisterRequestDto;
import com.bilgeadam.dto.response.LoginResponseDto;
import com.bilgeadam.dto.response.RegisterResponseDto;
import com.bilgeadam.rabbitmq.model.NewCreateUserModel;
import com.bilgeadam.rabbitmq.model.UpdateUserProfileModel;
import com.bilgeadam.repository.entity.Auth;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
Expand All @@ -27,5 +29,9 @@ public interface IAuthMapper {
@Mapping(source = "id", target = "authid")
})
CreateProfileRequestDto fromAuth(final Auth auth);
@Mapping(source = "id",target = "authId")
NewCreateUserModel toNewCreateUserModel(final Auth auth);


Auth toUserAuth( final UpdateUserProfileModel model);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.bilgeadam.rabbitmq.consumer;

import com.bilgeadam.mapper.IAuthMapper;
import com.bilgeadam.rabbitmq.model.UpdateUserProfileModel;
import com.bilgeadam.service.AuthService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@RequiredArgsConstructor
public class UpdateUserConsumer {

private final AuthService authService;


@RabbitListener(queues =("${rabbitmq.queueUpdate}") )
public void newUserCreate(UpdateUserProfileModel model){
log.info("User:{}",model.toString());
authService.save(IAuthMapper.INSTANCE.toUserAuth(model));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.bilgeadam.rabbitmq.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder

public class EmailSenderModel implements Serializable {

private String email;
private String activationCode;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.bilgeadam.rabbitmq.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder

public class NewCreateUserModel implements Serializable {
private Long authId;
private String email;
private String username;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.bilgeadam.rabbitmq.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder

public class UpdateUserProfileModel implements Serializable {
private String email;
private String activationCode;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.bilgeadam;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CompanyMicroserviceApplication {
public static void main(String[] args){
SpringApplication.run(CompanyMicroserviceApplication.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.bilgeadam.constants;

public class RestApi {
public static final String VERSION = "/v1";
public static final String COMPANY = VERSION+"/company";
public static final String COMPANYGETALL = "/companygetall";
public static final String CREATECOMPANY = "/createcompany";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.bilgeadam.controller;

import com.bilgeadam.dto.request.CreateCompanyRequestDto;
import com.bilgeadam.dto.response.CompanyGetAllResponseDto;
import com.bilgeadam.service.CompanyService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.bilgeadam.constants.RestApi.*;


@RestController
@RequestMapping(COMPANY)
@RequiredArgsConstructor
public class CompanyController {
private final CompanyService companyService;

@PostMapping(CREATECOMPANY)
public ResponseEntity<String> CreateCompany(@RequestBody CreateCompanyRequestDto dto) {

companyService.createCompany(dto);
return ResponseEntity.ok("başarıyla kaydedildi");
}
@GetMapping(COMPANYGETALL)
public ResponseEntity<List<CompanyGetAllResponseDto>> getAllCorporations(){
return ResponseEntity.ok(companyService.companyGetAll());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.bilgeadam.dto.request;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder

public class CreateCompanyRequestDto {
String name;
String title;
String mersisNo;
String taxNo;
String taxOffice;
String logo;
String phone;
String address;
String email;
int numberOfEmployees;
String foundationYear;
Date contractStartDate;
Date contractEndDate;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.bilgeadam.dto.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder

public class CompanyGetAllResponseDto {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.bilgeadam.dto.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder

public class CreateCompanyResponseDto {
String name;
String title;
String mersisNo;
String taxNo;
String taxOffice;
String logo;
String phone;
String address;
String email;
int numberOfEmployees;
String foundationYear;
Date contractStartDate;
Date contractEndDate;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.bilgeadam.exception;


import lombok.Getter;

@Getter
public class CompanyMicroserviceException extends RuntimeException{
private final ErrorType errorType;

public CompanyMicroserviceException(ErrorType errorType){
super(errorType.getMessage());
this.errorType = errorType;
}

public CompanyMicroserviceException(ErrorType errorType, String message){
super(message);
this.errorType = errorType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.bilgeadam.exception;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
@Component
public class ErrorMessage {
int code;
String message;
List<String> fields;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.bilgeadam.exception;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

@AllArgsConstructor
@NoArgsConstructor
@Getter
public enum ErrorType {
INTERNAL_ERROR(5100,"Sunucu Hatası", HttpStatus.INTERNAL_SERVER_ERROR),
BAD_REQUEST(1100,"Parametre Hatası",HttpStatus.BAD_REQUEST),
COMPANY_NOT_CREATED(1100,"Şirket kaydedilmedi",HttpStatus.BAD_REQUEST),

DUPLICATE_EMAIL_ERROR(1116,"Girdiginiz E-mail kullanilmakta.",HttpStatus.BAD_REQUEST);


int code;
String message;
HttpStatus httpStatus;
}
Loading

0 comments on commit 5c2710c

Please sign in to comment.