├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── resources ├── ERD.pgerd ├── hrms_ERDiagram.png ├── hrms_script-(Constraintleri_gosteren_sekli).sql └── hrms_script.sql └── src ├── main ├── java │ └── kodlamaio │ │ └── hrms │ │ ├── HrmsApplication.java │ │ ├── api │ │ └── controllers │ │ │ ├── AuthController.java │ │ │ ├── CandidatesController.java │ │ │ ├── CitiesController.java │ │ │ ├── CvLanguagesController.java │ │ │ ├── CvsController.java │ │ │ ├── EducationsController.java │ │ │ ├── EmployeesController.java │ │ │ ├── EmployersController.java │ │ │ ├── ExperiencesController.java │ │ │ ├── JobAdvertisementsController.java │ │ │ ├── JobPositionsController.java │ │ │ ├── PhotosController.java │ │ │ └── SkillsController.java │ │ ├── business │ │ ├── abstracts │ │ │ ├── ActivationService.java │ │ │ ├── AuthService.java │ │ │ ├── CandidateService.java │ │ │ ├── CheckRealPersonService.java │ │ │ ├── CityService.java │ │ │ ├── CvLanguageService.java │ │ │ ├── CvService.java │ │ │ ├── EducationService.java │ │ │ ├── EmployeeService.java │ │ │ ├── EmployerService.java │ │ │ ├── ExperienceService.java │ │ │ ├── JobAdvertisementService.java │ │ │ ├── JobPositionService.java │ │ │ ├── PhotoService.java │ │ │ ├── SkillService.java │ │ │ ├── UserService.java │ │ │ └── UserValidationService.java │ │ ├── adapters │ │ │ ├── MernisServiceAdapter.java │ │ │ └── cloudinary │ │ │ │ └── CloudinaryAdapterService.java │ │ ├── concretes │ │ │ ├── AuthManager.java │ │ │ ├── CandidateManager.java │ │ │ ├── CandidateValidationManager.java │ │ │ ├── CityManager.java │ │ │ ├── CvLanguageManager.java │ │ │ ├── CvManager.java │ │ │ ├── EducationManager.java │ │ │ ├── EmailActivationManager.java │ │ │ ├── EmployeeManager.java │ │ │ ├── EmployerManager.java │ │ │ ├── EmployerValidationManager.java │ │ │ ├── ExperienceManager.java │ │ │ ├── JobAdvertisementManager.java │ │ │ ├── JobPostionManager.java │ │ │ ├── PhotoManager.java │ │ │ ├── SkillManager.java │ │ │ └── UserManager.java │ │ └── constants │ │ │ └── Messages.java │ │ ├── core │ │ └── utilities │ │ │ ├── BeanDeserializerModifierForIgnorables.java │ │ │ ├── helpers │ │ │ └── PhotoUploadHelper.java │ │ │ └── results │ │ │ ├── DataResult.java │ │ │ ├── ErrorDataResult.java │ │ │ ├── ErrorResult.java │ │ │ ├── Result.java │ │ │ ├── SuccessDataResult.java │ │ │ └── SuccessResult.java │ │ ├── dataAccess │ │ └── abstracts │ │ │ ├── CandidateDao.java │ │ │ ├── CityDao.java │ │ │ ├── CvDao.java │ │ │ ├── CvLanguageDao.java │ │ │ ├── EducationDao.java │ │ │ ├── EmployeeDao.java │ │ │ ├── EmployerDao.java │ │ │ ├── ExperienceDao.java │ │ │ ├── JobAdvertisementDao.java │ │ │ ├── JobPositionDao.java │ │ │ ├── PhotoDao.java │ │ │ ├── SkillDao.java │ │ │ └── UserDao.java │ │ └── entities │ │ ├── abstracts │ │ └── ValidatableUser.java │ │ ├── concretes │ │ ├── Candidate.java │ │ ├── City.java │ │ ├── Cv.java │ │ ├── CvLanguage.java │ │ ├── Education.java │ │ ├── Employee.java │ │ ├── Employer.java │ │ ├── Experience.java │ │ ├── JobAdvertisement.java │ │ ├── JobPosition.java │ │ ├── Photo.java │ │ ├── Skill.java │ │ └── User.java │ │ └── dtos │ │ ├── CandidateForRegisterDto.java │ │ ├── CvDto.java │ │ ├── EmployerForRegisterDto.java │ │ ├── JobAdvertisementDto.java │ │ └── UserForLoginDto.java └── resources │ └── application.properties └── test └── java └── kodlamaio └── hrms └── HrmsApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import java.net.*; 17 | import java.io.*; 18 | import java.nio.channels.*; 19 | import java.util.Properties; 20 | 21 | public class MavenWrapperDownloader { 22 | 23 | private static final String WRAPPER_VERSION = "0.5.6"; 24 | /** 25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 26 | */ 27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 29 | 30 | /** 31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 32 | * use instead of the default one. 33 | */ 34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 35 | ".mvn/wrapper/maven-wrapper.properties"; 36 | 37 | /** 38 | * Path where the maven-wrapper.jar will be saved to. 39 | */ 40 | private static final String MAVEN_WRAPPER_JAR_PATH = 41 | ".mvn/wrapper/maven-wrapper.jar"; 42 | 43 | /** 44 | * Name of the property which should be used to override the default download url for the wrapper. 45 | */ 46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 47 | 48 | public static void main(String args[]) { 49 | System.out.println("- Downloader started"); 50 | File baseDirectory = new File(args[0]); 51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 52 | 53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 54 | // wrapperUrl parameter. 55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 56 | String url = DEFAULT_DOWNLOAD_URL; 57 | if(mavenWrapperPropertyFile.exists()) { 58 | FileInputStream mavenWrapperPropertyFileInputStream = null; 59 | try { 60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 61 | Properties mavenWrapperProperties = new Properties(); 62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 64 | } catch (IOException e) { 65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 66 | } finally { 67 | try { 68 | if(mavenWrapperPropertyFileInputStream != null) { 69 | mavenWrapperPropertyFileInputStream.close(); 70 | } 71 | } catch (IOException e) { 72 | // Ignore ... 73 | } 74 | } 75 | } 76 | System.out.println("- Downloading from: " + url); 77 | 78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 79 | if(!outputFile.getParentFile().exists()) { 80 | if(!outputFile.getParentFile().mkdirs()) { 81 | System.out.println( 82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 83 | } 84 | } 85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 86 | try { 87 | downloadFileFromURL(url, outputFile); 88 | System.out.println("Done"); 89 | System.exit(0); 90 | } catch (Throwable e) { 91 | System.out.println("- Error downloading"); 92 | e.printStackTrace(); 93 | System.exit(1); 94 | } 95 | } 96 | 97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 99 | String username = System.getenv("MVNW_USERNAME"); 100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 101 | Authenticator.setDefault(new Authenticator() { 102 | @Override 103 | protected PasswordAuthentication getPasswordAuthentication() { 104 | return new PasswordAuthentication(username, password); 105 | } 106 | }); 107 | } 108 | URL website = new URL(urlString); 109 | ReadableByteChannel rbc; 110 | rbc = Channels.newChannel(website.openStream()); 111 | FileOutputStream fos = new FileOutputStream(destination); 112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 113 | fos.close(); 114 | rbc.close(); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barisertugrul/HRMS_JavaProject/7bf7bb0d6fd4c11a53071d074b2037d98261fcb3/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HRMS_JavaProject 2 | Yazılım Geliştirici Yetiştirme Kampı (JAVA & REACT) Uygulama Projesi (Backend) 3 | 4 | 9.Gün Ödevleri: 5 | 6 | * Farklı alanlara başvuru için, aday başına birden fazla cv modeli temel alındı. 7 | * Birden çok okul, iş tecrübesi, yetenek/kullanılan teknoloji, yabancı dil ve fotoğraf eklenebilirliği gözetildi (ki fotoğraf dışındakiler için bu durum ödevde istenmiş), bu nedenle bu alanlar için ayrı tablolar oluşturuldu (cvs, skills, educations, experiences, languages ve photos). (Bu özellikler için birden fazla kayıt olabileceğinden dolayı, tek tabloda tutulması doğru olmazdı) 8 | * Ana özgeçmiş tablosu olan cvs tablosu user_id aracılığı ile Candidate tablosuna, skills, educations, experiences, languages ve photos tabloları da cv_id ile cvs tablosuna bağlandı. 9 | * Bütün cv alanlarını içerecek ve tek adımda kayıt yapılacak şekilde (Education list, Experience list, Skill List, Language list) Cv formu hazırlandı. Alt alanlar istenirse ayrı ayrı da eklenebilir. 10 | * Silme ve güncelleştirme metotları daha sonra eklenecektir. 11 | * Cv id'sine göre cloudinary platformuna fotoğraf yükleme metodu yazıldı (Cv formuyla birlikte yüklenebilmesi için code refactoring yapılacak) 12 | * Alınacak Okul ve iş deneyimi listelerinin cv ve kullanıcıya göre sorgulanacak, sorgu sonuçları tersten sıralanacak, mezuniyet veya işten ayrılma tarihlerinde null değerlere sahip kayıtlar en üstte olacak şekilde çıktı vermesi için gerekli metotlar yazıldı. (Listelerdeki Null değerlere "Devam ediyor" çıktısı yazdırılması, alanın Date tipinden çıkmasına yol açtığı için frontend tarafına bırakıldı) 13 | * Cloudinary servisi, core katmanına yerleştirilen bir upload helper interface'i implement edilerek, business katmanında adapters paketine yerleştirildi. Ve constructor injection ile PhotoManager içerisinde kullanıldı. 14 | * CvManager içerisindeki constructor injection parametrelerinin fazlalığı rahatsız ettiği için üzerinde çalışılacak. 15 | 16 | NOT: Cloudinary Service adaptasyonunu kullanmak isteyen arkadaşların, adapters paketindeki CloudinaryAdapterService içerisindeki api bilgilerini kendi üyelik bilgilerine göre doldurmaları yeterli olacaktır. 17 | 18 | Geçmiş: 19 | * İş arayanlar ve iş verenler için gerekli register işlemleri AuthManager içerisinde ayrı metotlarla gerçekleştiriliyor 20 | * Gerekli alanların doluluk ve uygunluk kontrolleri, Business katmanına yerleştirdiğim kendi Validation sınıfları ile yapılıyor. Tüm alan hataları toplu olarak kullanıcıya geri iletiliyor. 21 | * Email ve TC kimlik no uygunluk kontrolünü basit regex kalıpları ile yaptım, ama eksik olduğu için istisnalara yol açabiliyor. 22 | * İşveren domain-email uygunluğunu da aynı doğrulama sınıfında regex ile gerçekleştirdim. Regex kalıbı ile email adresindeki domain bölümünü ayırıp, website stringi ile eşitliğini kontrol ettim. 23 | * Yine mernis doğrulaması ve email ile aktivasyon kodu gönderimini constructor injection yoluyla eklediğim servisler aracılığı ile yaptım. 24 | * Kayıt verilerinin doğruluk kontrollerinin yapılacağı yere tam olarak karar veremedim ama ana işlemleri yapacak metotları manager sınıflarının içerisinden çağırma yöntemiyle AuthManager içerisinde yapmayı tercih ettim. 25 | * Aktivasyon kısıtlamalarını kontrol edebilmek için login metotları ekledim. Ancak her bir kullanıcı grubunun kontrol şartları farklı olduğu için ayrı login metotları tanımladım kullanıcı grupları için. Bu durum beni rahatsız ediyor ama şimdilik başka bir çözüm bulamadım. Üzerinde çalışıyorum hala. 26 | * Özellikle daha önceden kayıtlı kullanıcıları, belli şartlara bağlı olarak hızlıca ve az kodla tespit edebilmek için Engin hocanın paylaştığı https://www.baeldung.com/spring-data-derived-queries adresindeki yazıdan yararlanarak sorgular hazırladım. Login kontrolü için de aynı anda mail ve password eşleşmesini kontrol eden genişletilmiş sorgu kullandım. 27 | * Activasyon için AuthController içerisinde email ve activation code bilgilerini alan comfirmActivation metodu tanımlayıp, AuthManager içerisindeki ilgili metoda yönlendirme yaptım. 28 | 29 | 30 | ## ERDiagram 31 | ![alt ERDiagram](https://github.com/barisertugrul/HRMS_JavaProject/blob/master/resources/hrms_ERDiagram.png?raw=true) 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | fi 118 | 119 | if [ -z "$JAVA_HOME" ]; then 120 | javaExecutable="`which javac`" 121 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 122 | # readlink(1) is not available as standard on Solaris 10. 123 | readLink=`which readlink` 124 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 125 | if $darwin ; then 126 | javaHome="`dirname \"$javaExecutable\"`" 127 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 128 | else 129 | javaExecutable="`readlink -f \"$javaExecutable\"`" 130 | fi 131 | javaHome="`dirname \"$javaExecutable\"`" 132 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 133 | JAVA_HOME="$javaHome" 134 | export JAVA_HOME 135 | fi 136 | fi 137 | fi 138 | 139 | if [ -z "$JAVACMD" ] ; then 140 | if [ -n "$JAVA_HOME" ] ; then 141 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 142 | # IBM's JDK on AIX uses strange locations for the executables 143 | JAVACMD="$JAVA_HOME/jre/sh/java" 144 | else 145 | JAVACMD="$JAVA_HOME/bin/java" 146 | fi 147 | else 148 | JAVACMD="`which java`" 149 | fi 150 | fi 151 | 152 | if [ ! -x "$JAVACMD" ] ; then 153 | echo "Error: JAVA_HOME is not defined correctly." >&2 154 | echo " We cannot execute $JAVACMD" >&2 155 | exit 1 156 | fi 157 | 158 | if [ -z "$JAVA_HOME" ] ; then 159 | echo "Warning: JAVA_HOME environment variable is not set." 160 | fi 161 | 162 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 163 | 164 | # traverses directory structure from process work directory to filesystem root 165 | # first directory with .mvn subdirectory is considered project base directory 166 | find_maven_basedir() { 167 | 168 | if [ -z "$1" ] 169 | then 170 | echo "Path not specified to find_maven_basedir" 171 | return 1 172 | fi 173 | 174 | basedir="$1" 175 | wdir="$1" 176 | while [ "$wdir" != '/' ] ; do 177 | if [ -d "$wdir"/.mvn ] ; then 178 | basedir=$wdir 179 | break 180 | fi 181 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 182 | if [ -d "${wdir}" ]; then 183 | wdir=`cd "$wdir/.."; pwd` 184 | fi 185 | # end of workaround 186 | done 187 | echo "${basedir}" 188 | } 189 | 190 | # concatenates all lines of a file 191 | concat_lines() { 192 | if [ -f "$1" ]; then 193 | echo "$(tr -s '\n' ' ' < "$1")" 194 | fi 195 | } 196 | 197 | BASE_DIR=`find_maven_basedir "$(pwd)"` 198 | if [ -z "$BASE_DIR" ]; then 199 | exit 1; 200 | fi 201 | 202 | ########################################################################################## 203 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 204 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 205 | ########################################################################################## 206 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 207 | if [ "$MVNW_VERBOSE" = true ]; then 208 | echo "Found .mvn/wrapper/maven-wrapper.jar" 209 | fi 210 | else 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 213 | fi 214 | if [ -n "$MVNW_REPOURL" ]; then 215 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 216 | else 217 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 218 | fi 219 | while IFS="=" read key value; do 220 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 221 | esac 222 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 223 | if [ "$MVNW_VERBOSE" = true ]; then 224 | echo "Downloading from: $jarUrl" 225 | fi 226 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 227 | if $cygwin; then 228 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 229 | fi 230 | 231 | if command -v wget > /dev/null; then 232 | if [ "$MVNW_VERBOSE" = true ]; then 233 | echo "Found wget ... using wget" 234 | fi 235 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 236 | wget "$jarUrl" -O "$wrapperJarPath" 237 | else 238 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" 239 | fi 240 | elif command -v curl > /dev/null; then 241 | if [ "$MVNW_VERBOSE" = true ]; then 242 | echo "Found curl ... using curl" 243 | fi 244 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 245 | curl -o "$wrapperJarPath" "$jarUrl" -f 246 | else 247 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 248 | fi 249 | 250 | else 251 | if [ "$MVNW_VERBOSE" = true ]; then 252 | echo "Falling back to using Java to download" 253 | fi 254 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 255 | # For Cygwin, switch paths to Windows format before running javac 256 | if $cygwin; then 257 | javaClass=`cygpath --path --windows "$javaClass"` 258 | fi 259 | if [ -e "$javaClass" ]; then 260 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 261 | if [ "$MVNW_VERBOSE" = true ]; then 262 | echo " - Compiling MavenWrapperDownloader.java ..." 263 | fi 264 | # Compiling the Java class 265 | ("$JAVA_HOME/bin/javac" "$javaClass") 266 | fi 267 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 268 | # Running the downloader 269 | if [ "$MVNW_VERBOSE" = true ]; then 270 | echo " - Running MavenWrapperDownloader.java ..." 271 | fi 272 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 273 | fi 274 | fi 275 | fi 276 | fi 277 | ########################################################################################## 278 | # End of extension 279 | ########################################################################################## 280 | 281 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 282 | if [ "$MVNW_VERBOSE" = true ]; then 283 | echo $MAVEN_PROJECTBASEDIR 284 | fi 285 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 286 | 287 | # For Cygwin, switch paths to Windows format before running java 288 | if $cygwin; then 289 | [ -n "$M2_HOME" ] && 290 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 291 | [ -n "$JAVA_HOME" ] && 292 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 293 | [ -n "$CLASSPATH" ] && 294 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 295 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 296 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 297 | fi 298 | 299 | # Provide a "standardized" way to retrieve the CLI args that will 300 | # work with both Windows and non-Windows executions. 301 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 302 | export MAVEN_CMD_LINE_ARGS 303 | 304 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 305 | 306 | exec "$JAVACMD" \ 307 | $MAVEN_OPTS \ 308 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 309 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 310 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 311 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.4.5 9 | 10 | 11 | kodlamaio 12 | hrms 13 | 0.0.1-SNAPSHOT 14 | hrms 15 | HRMS project for Spring Boot 16 | 17 | 11 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-devtools 32 | runtime 33 | true 34 | 35 | 36 | org.postgresql 37 | postgresql 38 | runtime 39 | 40 | 41 | org.projectlombok 42 | lombok 43 | true 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-starter-test 48 | test 49 | 50 | 51 | io.springfox 52 | springfox-swagger2 53 | 2.9.2 54 | 55 | 56 | io.springfox 57 | springfox-swagger-ui 58 | 2.9.2 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-starter-validation 63 | 64 | 65 | com.cloudinary 66 | cloudinary-http44 67 | 1.29.0 68 | 69 | 70 | 71 | 72 | 73 | 74 | org.springframework.boot 75 | spring-boot-maven-plugin 76 | 77 | 78 | 79 | org.projectlombok 80 | lombok 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /resources/ERD.pgerd: -------------------------------------------------------------------------------- 1 | {"version":"50000","data":{"id":"f5c4e011-7922-4434-b7de-8660a70ea823","offsetX":-28.250000000000227,"offsetY":-249.20833317438775,"zoom":79.16666666666671,"gridSize":15,"layers":[{"id":"f572d985-0fd0-41b1-8653-76e292b9828b","type":"diagram-links","isSvg":true,"transformed":true,"models":{"0f8b407b-d5d6-4a35-ad6f-2a2a3efb62c0":{"id":"0f8b407b-d5d6-4a35-ad6f-2a2a3efb62c0","locked":true,"type":"onetomany","source":"c402744d-78c0-4239-8c62-9e5c795b4e0f","sourcePort":"409cc619-b4b0-4a39-8e53-ed86e0e43e5e","target":"4a9c20cc-54e1-4f8c-ad47-ddafeecd8e55","targetPort":"93e98d39-f030-4cfd-a9f3-42a6034adcfc","points":[{"id":"49e8e774-97e4-456a-9e27-c8399a65a3c0","type":"point","x":679,"y":106.39999771118164},{"id":"35ca1d17-6dfd-477e-b610-c309c5442cf7","type":"point","x":679,"y":519.5874977111816},{"id":"914d17f4-6c5c-4026-9ada-884779a96702","type":"point","x":209,"y":519.5874977111816}],"labels":[],"width":1,"color":"gray","curvyness":50,"selectedColor":"rgb(0,192,255)","data":{"local_table_uid":"4a9c20cc-54e1-4f8c-ad47-ddafeecd8e55","local_column_attnum":1,"referenced_table_uid":"c402744d-78c0-4239-8c62-9e5c795b4e0f","referenced_column_attnum":1}},"7a325d86-b795-4bd8-b6fd-58fd07f258be":{"id":"7a325d86-b795-4bd8-b6fd-58fd07f258be","locked":true,"type":"onetomany","source":"b3096edf-5904-4131-b87a-37cf6e5aadf3","sourcePort":"986313a6-a99b-4bc2-b1d9-6dab028595a4","target":"b3096edf-5904-4131-b87a-37cf6e5aadf3","targetPort":"986313a6-a99b-4bc2-b1d9-6dab028595a4","points":[{"id":"480c27bb-d194-41ee-8ebd-6b65cf5bd27c","type":"point","x":434,"y":583.4859352111816},{"id":"e1b5330f-f758-4fd5-85d4-57c3b06e2f90","type":"point","x":434,"y":482.0859375},{"id":"ac44489b-ff61-4e39-b4c1-bd5d077e7572","type":"point","x":434.1666666666667,"y":482.0859375},{"id":"2dc4d230-7641-4130-bf35-e9cb4612acb4","type":"point","x":440,"y":556.28125},{"id":"551a98ef-9533-41c4-aafd-b650257ead1b","type":"point","x":434,"y":630.4765625},{"id":"69a1d761-9b5c-41e8-85eb-c6d2d341a903","type":"point","x":434,"y":583.4859352111816}],"labels":[],"width":1,"color":"gray","curvyness":50,"selectedColor":"rgb(0,192,255)","data":{"local_table_uid":"b3096edf-5904-4131-b87a-37cf6e5aadf3","local_column_attnum":1,"referenced_table_uid":"b3096edf-5904-4131-b87a-37cf6e5aadf3","referenced_column_attnum":1}},"fc5a65a9-e60f-47bf-b716-a55334a4acb3":{"id":"fc5a65a9-e60f-47bf-b716-a55334a4acb3","locked":true,"type":"onetomany","source":"c402744d-78c0-4239-8c62-9e5c795b4e0f","sourcePort":"409cc619-b4b0-4a39-8e53-ed86e0e43e5e","target":"89518e49-7f2d-4890-b90c-abb121057b16","targetPort":"a8d1ec43-a5aa-49c2-9dc3-ac77e0b0a045","points":[{"id":"97d3df06-e204-4cd9-af9a-d77c68379f12","type":"point","x":679,"y":106.39999771118164},{"id":"e8abe4ab-2afa-4f99-8920-2931158d3322","type":"point","x":679,"y":555.3843727111816},{"id":"7e6863b4-2129-4506-8ed1-7e77871cd5b9","type":"point","x":679,"y":555.3843727111816}],"labels":[],"width":1,"color":"gray","curvyness":50,"selectedColor":"rgb(0,192,255)","data":{"local_table_uid":"89518e49-7f2d-4890-b90c-abb121057b16","local_column_attnum":1,"referenced_table_uid":"c402744d-78c0-4239-8c62-9e5c795b4e0f","referenced_column_attnum":1}},"a456f9e3-7f33-486f-a011-54c27f1aab1c":{"id":"a456f9e3-7f33-486f-a011-54c27f1aab1c","locked":true,"type":"onetomany","source":"c402744d-78c0-4239-8c62-9e5c795b4e0f","sourcePort":"409cc619-b4b0-4a39-8e53-ed86e0e43e5e","target":"19668508-6e7c-44a5-8456-7ca32cbbce59","targetPort":"40e6f76a-5022-4946-a30e-10a8609d51d1","points":[{"id":"f5553a83-eda4-406c-a551-00bbc00add79","type":"point","x":679,"y":106.39999771118164},{"id":"9b2df6d9-4261-4ec0-9863-fa0efcdc209d","type":"point","x":679,"y":519.5874977111816},{"id":"f306b203-9b39-485d-aa42-c1360aad2d3b","type":"point","x":904,"y":519.5874977111816}],"labels":[],"width":1,"color":"gray","curvyness":50,"selectedColor":"rgb(0,192,255)","data":{"local_table_uid":"19668508-6e7c-44a5-8456-7ca32cbbce59","local_column_attnum":1,"referenced_table_uid":"c402744d-78c0-4239-8c62-9e5c795b4e0f","referenced_column_attnum":1}},"9aa45154-bd33-43c5-91b3-c594f0b12c69":{"id":"9aa45154-bd33-43c5-91b3-c594f0b12c69","locked":true,"type":"onetomany","source":"b3096edf-5904-4131-b87a-37cf6e5aadf3","sourcePort":"986313a6-a99b-4bc2-b1d9-6dab028595a4","target":"fa782b46-58bf-4052-b9dd-daaf2c18a313","targetPort":"d28ac15b-b1af-4ce8-aa14-e6d1bd2694d8","points":[{"id":"aa5e6f6b-6c63-42bf-84b1-c307d7beba84","type":"point","x":434,"y":583.4859352111816},{"id":"ef435b95-d39e-4520-a99d-13bcdd9c8298","type":"point","x":434,"y":903.7750129699707},{"id":"cd4794b4-d2b0-4b77-86c8-0f344674e292","type":"point","x":904,"y":903.7750129699707}],"labels":[],"width":1,"color":"gray","curvyness":50,"selectedColor":"rgb(0,192,255)","data":{"local_table_uid":"fa782b46-58bf-4052-b9dd-daaf2c18a313","local_column_attnum":3,"referenced_table_uid":"b3096edf-5904-4131-b87a-37cf6e5aadf3","referenced_column_attnum":1}},"ade43f63-9db8-44ca-bf5e-77138b175690":{"id":"ade43f63-9db8-44ca-bf5e-77138b175690","locked":true,"type":"onetomany","source":"19668508-6e7c-44a5-8456-7ca32cbbce59","sourcePort":"40e6f76a-5022-4946-a30e-10a8609d51d1","target":"fa782b46-58bf-4052-b9dd-daaf2c18a313","targetPort":"004f48dc-1a98-434f-8491-11e7b3412997","points":[{"id":"b046df7e-5736-4471-8254-fde2575aa32b","type":"point","x":904,"y":519.5874977111816},{"id":"6cdabb0f-a69e-4e8d-9f8e-f9d11e9c8309","type":"point","x":904,"y":1120.3750190734863},{"id":"95a30223-bd4d-47f6-ad6a-a29cf43db44f","type":"point","x":904,"y":1120.3750190734863}],"labels":[],"width":1,"color":"gray","curvyness":50,"selectedColor":"rgb(0,192,255)","data":{"local_table_uid":"fa782b46-58bf-4052-b9dd-daaf2c18a313","local_column_attnum":10,"referenced_table_uid":"19668508-6e7c-44a5-8456-7ca32cbbce59","referenced_column_attnum":1}},"9c84e5ba-347f-4dec-bf70-88ec74503f0f":{"id":"9c84e5ba-347f-4dec-bf70-88ec74503f0f","locked":true,"type":"onetomany","source":"ccd07543-3e48-47e1-86ad-f561d0a8e9fe","sourcePort":"4e380d36-9af2-4536-8508-939c93fa2d98","target":"fa782b46-58bf-4052-b9dd-daaf2c18a313","targetPort":"ece5622e-a0f7-48b1-83e6-fef96527374c","points":[{"id":"4d3d04f9-3f37-4b0a-83d2-fe14376752a0","type":"point","x":1129,"y":562.1812477111816},{"id":"adb0a1ea-7627-4a7d-b054-35b738970436","type":"point","x":1129,"y":874.7749977111816},{"id":"818772a1-5f54-4cc6-9782-c747cec5c054","type":"point","x":904,"y":874.7749977111816}],"labels":[],"width":1,"color":"gray","curvyness":50,"selectedColor":"rgb(0,192,255)","data":{"local_table_uid":"fa782b46-58bf-4052-b9dd-daaf2c18a313","local_column_attnum":2,"referenced_table_uid":"ccd07543-3e48-47e1-86ad-f561d0a8e9fe","referenced_column_attnum":1}}}},{"id":"0cadf1d8-f47a-4a0b-b84e-57ae5c9c86f9","type":"diagram-nodes","isSvg":false,"transformed":true,"models":{"4a9c20cc-54e1-4f8c-ad47-ddafeecd8e55":{"id":"4a9c20cc-54e1-4f8c-ad47-ddafeecd8e55","type":"table","x":5,"y":418.1875,"ports":[{"id":"93e98d39-f030-4cfd-a9f3-42a6034adcfc","type":"onetomany","x":179,"y":519.5874977111816,"name":"coll-port-1","alignment":"right","parentNode":"4a9c20cc-54e1-4f8c-ad47-ddafeecd8e55","links":["0f8b407b-d5d6-4a35-ad6f-2a2a3efb62c0"],"subtype":"many"}],"name":"Untitled","color":"rgb(0,192,255)","portsInOrder":[],"portsOutOrder":["93e98d39-f030-4cfd-a9f3-42a6034adcfc"],"otherInfo":{"data":{"columns":[{"name":"user_id","description":null,"attnum":1,"cltype":"smallint","is_primary_key":true,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"first_name","description":null,"attnum":3,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"30","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"last_name","description":null,"attnum":4,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"30","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"nationality_id","description":null,"attnum":5,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"15","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"year_of_birth","description":null,"attnum":7,"cltype":"smallint","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null}],"name":"candidates","schema":"public","description":null,"primary_key":[{"columns":[{"column":"user_id"}]}]},"note":""}},"b3096edf-5904-4131-b87a-37cf6e5aadf3":{"id":"b3096edf-5904-4131-b87a-37cf6e5aadf3","type":"table","x":230,"y":482.0859375,"ports":[{"id":"986313a6-a99b-4bc2-b1d9-6dab028595a4","type":"onetomany","x":404,"y":583.4859352111816,"name":"coll-port-1","alignment":"right","parentNode":"b3096edf-5904-4131-b87a-37cf6e5aadf3","links":["7a325d86-b795-4bd8-b6fd-58fd07f258be","9aa45154-bd33-43c5-91b3-c594f0b12c69"],"subtype":"one"}],"name":"Untitled","color":"rgb(0,192,255)","portsInOrder":[],"portsOutOrder":["986313a6-a99b-4bc2-b1d9-6dab028595a4"],"otherInfo":{"data":{"columns":[{"name":"city_id","description":null,"attnum":1,"cltype":"smallint","is_primary_key":true,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"city_name","description":null,"attnum":2,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null}],"name":"cities","schema":"public","description":null,"primary_key":[{"columns":[{"column":"city_id"}]}]},"note":""}},"89518e49-7f2d-4890-b90c-abb121057b16":{"id":"89518e49-7f2d-4890-b90c-abb121057b16","type":"table","x":475,"y":453.984375,"ports":[{"id":"a8d1ec43-a5aa-49c2-9dc3-ac77e0b0a045","type":"onetomany","x":649,"y":555.3843727111816,"name":"coll-port-1","alignment":"right","parentNode":"89518e49-7f2d-4890-b90c-abb121057b16","links":["fc5a65a9-e60f-47bf-b716-a55334a4acb3"],"subtype":"many"}],"name":"Untitled","color":"rgb(0,192,255)","portsInOrder":[],"portsOutOrder":["a8d1ec43-a5aa-49c2-9dc3-ac77e0b0a045"],"otherInfo":{"data":{"columns":[{"name":"user_id","description":null,"attnum":1,"cltype":"smallint","is_primary_key":true,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"first_name","description":null,"attnum":3,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"35","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"last_name","description":null,"attnum":4,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"35","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null}],"name":"employees","schema":"public","description":null,"primary_key":[{"columns":[{"column":"user_id"}]}]},"note":""}},"19668508-6e7c-44a5-8456-7ca32cbbce59":{"id":"19668508-6e7c-44a5-8456-7ca32cbbce59","type":"table","x":700,"y":418.1875,"ports":[{"id":"40e6f76a-5022-4946-a30e-10a8609d51d1","type":"onetomany","x":874,"y":519.5874977111816,"name":"coll-port-1","alignment":"right","parentNode":"19668508-6e7c-44a5-8456-7ca32cbbce59","links":["a456f9e3-7f33-486f-a011-54c27f1aab1c","ade43f63-9db8-44ca-bf5e-77138b175690"],"subtype":"many"}],"name":"Untitled","color":"rgb(0,192,255)","portsInOrder":[],"portsOutOrder":["40e6f76a-5022-4946-a30e-10a8609d51d1"],"otherInfo":{"data":{"columns":[{"name":"user_id","description":null,"attnum":1,"cltype":"smallint","is_primary_key":true,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"company_name","description":null,"attnum":3,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"100","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"phone_number","description":null,"attnum":4,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"15","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"admin_confirm","description":null,"attnum":5,"cltype":"boolean","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"website","description":null,"attnum":6,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"50","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null}],"name":"employers","schema":"public","description":null,"primary_key":[{"columns":[{"column":"user_id"}]}]},"note":""}},"fa782b46-58bf-4052-b9dd-daaf2c18a313":{"id":"fa782b46-58bf-4052-b9dd-daaf2c18a313","type":"table","x":700,"y":744.375,"ports":[{"id":"d28ac15b-b1af-4ce8-aa14-e6d1bd2694d8","type":"onetomany","x":874,"y":903.7750129699707,"name":"coll-port-3","alignment":"right","parentNode":"fa782b46-58bf-4052-b9dd-daaf2c18a313","links":["9aa45154-bd33-43c5-91b3-c594f0b12c69"],"subtype":"many"},{"id":"004f48dc-1a98-434f-8491-11e7b3412997","type":"onetomany","x":874,"y":1120.3750190734863,"name":"coll-port-10","alignment":"right","parentNode":"fa782b46-58bf-4052-b9dd-daaf2c18a313","links":["ade43f63-9db8-44ca-bf5e-77138b175690"],"subtype":"many"},{"id":"ece5622e-a0f7-48b1-83e6-fef96527374c","type":"onetomany","x":874,"y":874.7749977111816,"name":"coll-port-2","alignment":"right","parentNode":"fa782b46-58bf-4052-b9dd-daaf2c18a313","links":["9c84e5ba-347f-4dec-bf70-88ec74503f0f"],"subtype":"many"}],"name":"Untitled","color":"rgb(0,192,255)","portsInOrder":[],"portsOutOrder":["d28ac15b-b1af-4ce8-aa14-e6d1bd2694d8","004f48dc-1a98-434f-8491-11e7b3412997","ece5622e-a0f7-48b1-83e6-fef96527374c"],"otherInfo":{"data":{"columns":[{"name":"advertise_id","description":null,"attnum":1,"cltype":"smallint","is_primary_key":true,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"a","colconstype":"i","seqincrement":"1","seqstart":"1","seqmin":"1","seqmax":"32767","seqcache":"1","seqcycle":false},{"name":"position_id","description":null,"attnum":2,"cltype":"smallint","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"city_id","description":null,"attnum":3,"cltype":"smallint","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"job_definition","description":null,"attnum":4,"cltype":"text","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"min_salary","description":null,"attnum":5,"cltype":"money","is_primary_key":false,"attnotnull":false,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"max_salary","description":null,"attnum":6,"cltype":"money","is_primary_key":false,"attnotnull":false,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"number_of_open_positions","description":null,"attnum":7,"cltype":"smallint","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"created_date","description":null,"attnum":8,"cltype":"date","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"expiration_date","description":null,"attnum":9,"cltype":"date","is_primary_key":false,"attnotnull":false,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"employer_id","description":null,"attnum":10,"cltype":"smallint","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"is_active","description":null,"attnum":11,"cltype":"boolean","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null}],"name":"job_advertises","schema":"public","description":null,"primary_key":[{"columns":[{"column":"advertise_id"}]}]},"note":""}},"ccd07543-3e48-47e1-86ad-f561d0a8e9fe":{"id":"ccd07543-3e48-47e1-86ad-f561d0a8e9fe","type":"table","x":925,"y":460.78125,"ports":[{"id":"4e380d36-9af2-4536-8508-939c93fa2d98","type":"onetomany","x":1099,"y":562.1812477111816,"name":"coll-port-1","alignment":"right","parentNode":"ccd07543-3e48-47e1-86ad-f561d0a8e9fe","links":["9c84e5ba-347f-4dec-bf70-88ec74503f0f"],"subtype":"one"}],"name":"Untitled","color":"rgb(0,192,255)","portsInOrder":[],"portsOutOrder":["4e380d36-9af2-4536-8508-939c93fa2d98"],"otherInfo":{"data":{"columns":[{"name":"position_id","description":null,"attnum":1,"cltype":"smallint","is_primary_key":true,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"a","colconstype":"i","seqincrement":"1","seqstart":"1","seqmin":"1","seqmax":"32767","seqcache":"1","seqcycle":false},{"name":"position_name","description":null,"attnum":4,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"30","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"position_description","description":null,"attnum":5,"cltype":"text","is_primary_key":false,"attnotnull":false,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null}],"name":"job_positions","schema":"public","description":null,"primary_key":[{"columns":[{"column":"position_id"}]}]},"note":""}},"c402744d-78c0-4239-8c62-9e5c795b4e0f":{"id":"c402744d-78c0-4239-8c62-9e5c795b4e0f","type":"table","x":475,"y":5,"ports":[{"id":"409cc619-b4b0-4a39-8e53-ed86e0e43e5e","type":"onetomany","x":649,"y":106.39999771118164,"name":"coll-port-1","alignment":"right","parentNode":"c402744d-78c0-4239-8c62-9e5c795b4e0f","links":["0f8b407b-d5d6-4a35-ad6f-2a2a3efb62c0","fc5a65a9-e60f-47bf-b716-a55334a4acb3","a456f9e3-7f33-486f-a011-54c27f1aab1c"],"subtype":"one"}],"name":"Untitled","color":"rgb(0,192,255)","portsInOrder":[],"portsOutOrder":["409cc619-b4b0-4a39-8e53-ed86e0e43e5e"],"otherInfo":{"data":{"columns":[{"name":"id","description":null,"attnum":1,"cltype":"smallint","is_primary_key":true,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"a","colconstype":"i","seqincrement":"1","seqstart":"1","seqmin":"1","seqmax":"32767","seqcache":"1","seqcycle":false},{"name":"email","description":null,"attnum":4,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"50","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"password","description":null,"attnum":5,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"500","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"register_date","description":null,"attnum":6,"cltype":"timestamp with time zone","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"activation_code","description":null,"attnum":7,"cltype":"character varying","is_primary_key":false,"attnotnull":true,"attlen":"500","attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"email_comfirm","description":null,"attnum":8,"cltype":"boolean","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"is_active","description":null,"attnum":9,"cltype":"boolean","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null},{"name":"is_deleted","description":null,"attnum":10,"cltype":"boolean","is_primary_key":false,"attnotnull":true,"attlen":null,"attprecision":null,"attidentity":"","colconstype":"n","seqincrement":null,"seqstart":null,"seqmin":null,"seqmax":null,"seqcache":null,"seqcycle":null}],"name":"users","schema":"public","description":null,"primary_key":[{"columns":[{"column":"id"}]}]},"note":""}}}}]}} -------------------------------------------------------------------------------- /resources/hrms_ERDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/barisertugrul/HRMS_JavaProject/7bf7bb0d6fd4c11a53071d074b2037d98261fcb3/resources/hrms_ERDiagram.png -------------------------------------------------------------------------------- /resources/hrms_script-(Constraintleri_gosteren_sekli).sql: -------------------------------------------------------------------------------- 1 | -- Database: Hrms 2 | 3 | -- DROP DATABASE "Hrms"; 4 | 5 | CREATE DATABASE "Hrms" 6 | WITH 7 | OWNER = postgres 8 | ENCODING = 'UTF8' 9 | LC_COLLATE = 'Turkish_Turkey.1254' 10 | LC_CTYPE = 'Turkish_Turkey.1254' 11 | TABLESPACE = pg_default 12 | CONNECTION LIMIT = -1; 13 | 14 | 15 | 16 | -- Table: public.employees 17 | 18 | -- DROP TABLE public.employees; 19 | 20 | CREATE TABLE public.employees 21 | ( 22 | user_id smallint NOT NULL, 23 | first_name character varying(35) COLLATE pg_catalog."default" NOT NULL, 24 | last_name character varying(35) COLLATE pg_catalog."default" NOT NULL, 25 | CONSTRAINT employees_pkey PRIMARY KEY (user_id), 26 | CONSTRAINT employees_user_id_fkey FOREIGN KEY (user_id) 27 | REFERENCES public.users (id) MATCH SIMPLE 28 | ON UPDATE NO ACTION 29 | ON DELETE NO ACTION 30 | NOT VALID 31 | ) 32 | 33 | TABLESPACE pg_default; 34 | 35 | ALTER TABLE public.employees 36 | OWNER to postgres; 37 | 38 | 39 | -- Table: public.employers 40 | 41 | -- DROP TABLE public.employers; 42 | 43 | CREATE TABLE public.employers 44 | ( 45 | user_id smallint NOT NULL, 46 | company_name character varying(100) COLLATE pg_catalog."default" NOT NULL, 47 | phone_number character varying(15) COLLATE pg_catalog."default" NOT NULL, 48 | admin_confirm boolean NOT NULL DEFAULT false, 49 | website character varying(50) COLLATE pg_catalog."default" NOT NULL, 50 | CONSTRAINT employers_pkey PRIMARY KEY (user_id), 51 | CONSTRAINT employers_user_id_fkey FOREIGN KEY (user_id) 52 | REFERENCES public.users (id) MATCH SIMPLE 53 | ON UPDATE NO ACTION 54 | ON DELETE NO ACTION 55 | NOT VALID 56 | ) 57 | 58 | TABLESPACE pg_default; 59 | 60 | ALTER TABLE public.employers 61 | OWNER to postgres; 62 | 63 | 64 | -- Table: public.job_positions 65 | 66 | -- DROP TABLE public.job_positions; 67 | 68 | CREATE TABLE public.job_positions 69 | ( 70 | position_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 71 | position_name character varying(30) COLLATE pg_catalog."default" NOT NULL, 72 | position_description text COLLATE pg_catalog."default", 73 | CONSTRAINT job_positions_pkey PRIMARY KEY (position_id) 74 | ) 75 | 76 | TABLESPACE pg_default; 77 | 78 | ALTER TABLE public.job_positions 79 | OWNER to postgres; 80 | 81 | 82 | -- Table: public.candidates 83 | 84 | -- DROP TABLE public.candidates; 85 | 86 | CREATE TABLE public.candidates 87 | ( 88 | user_id smallint NOT NULL, 89 | first_name character varying(30) COLLATE pg_catalog."default" NOT NULL, 90 | last_name character varying(30) COLLATE pg_catalog."default" NOT NULL, 91 | nationality_id character varying(15) COLLATE pg_catalog."default" NOT NULL, 92 | year_of_birth smallint NOT NULL, 93 | CONSTRAINT job_seeker_pkey PRIMARY KEY (user_id), 94 | CONSTRAINT job_seeker_nationality_id_key UNIQUE (nationality_id), 95 | CONSTRAINT job_seeker_user_id_fkey FOREIGN KEY (user_id) 96 | REFERENCES public.users (id) MATCH SIMPLE 97 | ON UPDATE NO ACTION 98 | ON DELETE NO ACTION 99 | NOT VALID 100 | ) 101 | 102 | TABLESPACE pg_default; 103 | 104 | ALTER TABLE public.candidates 105 | OWNER to postgres; 106 | 107 | 108 | -- Table: public.users 109 | 110 | -- DROP TABLE public.users; 111 | 112 | CREATE TABLE public.users 113 | ( 114 | id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 115 | email character varying(50) COLLATE pg_catalog."default" NOT NULL, 116 | password character varying(500) COLLATE pg_catalog."default" NOT NULL, 117 | register_date timestamp with time zone NOT NULL, 118 | activation_code character varying(500) COLLATE pg_catalog."default" NOT NULL DEFAULT true, 119 | email_comfirm boolean NOT NULL DEFAULT false, 120 | is_active boolean NOT NULL DEFAULT false, 121 | is_deleted boolean NOT NULL DEFAULT false, 122 | CONSTRAINT users_pkey PRIMARY KEY (id) 123 | ) 124 | 125 | TABLESPACE pg_default; 126 | 127 | ALTER TABLE public.users 128 | OWNER to postgres; 129 | 130 | 131 | -- Table: public.job_advertisements 132 | 133 | -- DROP TABLE public.job_advertisements; 134 | 135 | CREATE TABLE public.job_advertisements 136 | ( 137 | advertisement_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 138 | position_id smallint NOT NULL, 139 | city_id smallint NOT NULL, 140 | job_definition text COLLATE pg_catalog."default" NOT NULL, 141 | min_salary numeric(10,2), 142 | max_salary numeric(10,2), 143 | number_of_open_positions smallint NOT NULL, 144 | created_date date NOT NULL DEFAULT CURRENT_TIMESTAMP, 145 | expiration_date date, 146 | employer_id smallint NOT NULL, 147 | is_active boolean NOT NULL DEFAULT true, 148 | expiration_dated date, 149 | CONSTRAINT job_advertises_pkey PRIMARY KEY (advertisement_id), 150 | CONSTRAINT job_advertises_city_id_fkey FOREIGN KEY (city_id) 151 | REFERENCES public.cities (city_id) MATCH SIMPLE 152 | ON UPDATE NO ACTION 153 | ON DELETE NO ACTION, 154 | CONSTRAINT job_advertises_employer_id_fkey FOREIGN KEY (employer_id) 155 | REFERENCES public.employers (user_id) MATCH SIMPLE 156 | ON UPDATE NO ACTION 157 | ON DELETE NO ACTION, 158 | CONSTRAINT job_advertises_position_id_fkey FOREIGN KEY (position_id) 159 | REFERENCES public.job_positions (position_id) MATCH SIMPLE 160 | ON UPDATE NO ACTION 161 | ON DELETE NO ACTION 162 | ) 163 | 164 | TABLESPACE pg_default; 165 | 166 | ALTER TABLE public.job_advertisements 167 | OWNER to postgres; 168 | 169 | 170 | -- Table: public.cities 171 | 172 | -- DROP TABLE public.cities; 173 | 174 | CREATE TABLE public.cities 175 | ( 176 | city_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 177 | city_name character varying COLLATE pg_catalog."default" NOT NULL, 178 | CONSTRAINT cities_pkey PRIMARY KEY (city_id), 179 | CONSTRAINT fkob77udyax7da1dcmsoymcrs8i FOREIGN KEY (city_id) 180 | REFERENCES public.cities (city_id) MATCH SIMPLE 181 | ON UPDATE NO ACTION 182 | ON DELETE NO ACTION 183 | ) 184 | 185 | TABLESPACE pg_default; 186 | 187 | ALTER TABLE public.cities 188 | OWNER to postgres; 189 | 190 | 191 | 192 | -- Table: public.cvs 193 | 194 | -- DROP TABLE public.cvs; 195 | 196 | CREATE TABLE public.cvs 197 | ( 198 | cv_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 199 | user_id smallint NOT NULL, 200 | github_link character varying(255) COLLATE pg_catalog."default", 201 | linkedin_link character varying(255) COLLATE pg_catalog."default", 202 | summary text COLLATE pg_catalog."default", 203 | CONSTRAINT cvs_pkey PRIMARY KEY (cv_id), 204 | CONSTRAINT cvs_user_id_fkey FOREIGN KEY (user_id) 205 | REFERENCES public.candidates (user_id) MATCH SIMPLE 206 | ON UPDATE NO ACTION 207 | ON DELETE NO ACTION 208 | NOT VALID 209 | ) 210 | 211 | TABLESPACE pg_default; 212 | 213 | ALTER TABLE public.cvs 214 | OWNER to postgres; 215 | 216 | 217 | -- Table: public.cv_languages 218 | 219 | -- DROP TABLE public.cv_languages; 220 | 221 | CREATE TABLE public.cv_languages 222 | ( 223 | language_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 224 | cv_id smallint NOT NULL, 225 | language_name character varying(30) COLLATE pg_catalog."default" NOT NULL, 226 | language_level smallint NOT NULL, 227 | CONSTRAINT cv_languages_pkey PRIMARY KEY (language_id), 228 | CONSTRAINT cv_languages_cv_id_fkey FOREIGN KEY (cv_id) 229 | REFERENCES public.cvs (cv_id) MATCH SIMPLE 230 | ON UPDATE NO ACTION 231 | ON DELETE NO ACTION 232 | ) 233 | 234 | TABLESPACE pg_default; 235 | 236 | ALTER TABLE public.cv_languages 237 | OWNER to postgres; 238 | 239 | 240 | 241 | -- Table: public.educations 242 | 243 | -- DROP TABLE public.educations; 244 | 245 | CREATE TABLE public.educations 246 | ( 247 | education_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 248 | cv_id smallint NOT NULL, 249 | school_name character varying(100) COLLATE pg_catalog."default" NOT NULL, 250 | program_name character varying(100) COLLATE pg_catalog."default" NOT NULL, 251 | start_date date NOT NULL, 252 | graduation_date date, 253 | CONSTRAINT schools_pkey PRIMARY KEY (education_id), 254 | CONSTRAINT schools_cv_id_fkey FOREIGN KEY (cv_id) 255 | REFERENCES public.cvs (cv_id) MATCH SIMPLE 256 | ON UPDATE NO ACTION 257 | ON DELETE NO ACTION 258 | ) 259 | 260 | TABLESPACE pg_default; 261 | 262 | ALTER TABLE public.educations 263 | OWNER to postgres; 264 | 265 | 266 | 267 | -- Table: public.experiences 268 | 269 | -- DROP TABLE public.experiences; 270 | 271 | CREATE TABLE public.experiences 272 | ( 273 | experience_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 274 | cv_id smallint NOT NULL, 275 | workplace_name character varying(100) COLLATE pg_catalog."default" NOT NULL, 276 | job_title character varying(50) COLLATE pg_catalog."default" NOT NULL, 277 | start_date date NOT NULL, 278 | departure_date date, 279 | CONSTRAINT experiences_pkey PRIMARY KEY (experience_id), 280 | CONSTRAINT experiences_cv_id_fkey FOREIGN KEY (cv_id) 281 | REFERENCES public.cvs (cv_id) MATCH SIMPLE 282 | ON UPDATE NO ACTION 283 | ON DELETE NO ACTION 284 | ) 285 | 286 | TABLESPACE pg_default; 287 | 288 | ALTER TABLE public.experiences 289 | OWNER to postgres; 290 | 291 | 292 | 293 | -- Table: public.photos 294 | 295 | -- DROP TABLE public.photos; 296 | 297 | CREATE TABLE public.photos 298 | ( 299 | photo_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 300 | cv_id smallint NOT NULL, 301 | title character varying(50) COLLATE pg_catalog."default" NOT NULL, 302 | image character varying(255) COLLATE pg_catalog."default" NOT NULL, 303 | created_date date NOT NULL DEFAULT CURRENT_TIMESTAMP, 304 | CONSTRAINT photos_pkey PRIMARY KEY (photo_id), 305 | CONSTRAINT photos_cv_id_fkey FOREIGN KEY (cv_id) 306 | REFERENCES public.cvs (cv_id) MATCH SIMPLE 307 | ON UPDATE NO ACTION 308 | ON DELETE NO ACTION 309 | ) 310 | 311 | TABLESPACE pg_default; 312 | 313 | ALTER TABLE public.photos 314 | OWNER to postgres; 315 | 316 | 317 | 318 | -- Table: public.skills 319 | 320 | -- DROP TABLE public.skills; 321 | 322 | CREATE TABLE public.skills 323 | ( 324 | skill_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 325 | cv_id smallint NOT NULL, 326 | skill character varying(50) COLLATE pg_catalog."default" NOT NULL, 327 | skill_level smallint, 328 | CONSTRAINT skills_pkey PRIMARY KEY (skill_id), 329 | CONSTRAINT skills_cv_id_fkey FOREIGN KEY (cv_id) 330 | REFERENCES public.cvs (cv_id) MATCH SIMPLE 331 | ON UPDATE NO ACTION 332 | ON DELETE NO ACTION 333 | ) 334 | 335 | TABLESPACE pg_default; 336 | 337 | ALTER TABLE public.skills 338 | OWNER to postgres; -------------------------------------------------------------------------------- /resources/hrms_script.sql: -------------------------------------------------------------------------------- 1 | -- This script was generated by a beta version of the ERD tool in pgAdmin 4. 2 | -- Please log an issue at https://redmine.postgresql.org/projects/pgadmin4/issues/new if you find any bugs, including reproduction steps. 3 | BEGIN; 4 | 5 | 6 | CREATE TABLE public.candidates 7 | ( 8 | user_id smallint NOT NULL, 9 | first_name character varying(30) NOT NULL, 10 | last_name character varying(30) NOT NULL, 11 | nationality_id character varying(15) NOT NULL, 12 | year_of_birth smallint NOT NULL, 13 | PRIMARY KEY (user_id) 14 | ); 15 | 16 | CREATE TABLE public.cities 17 | ( 18 | city_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 19 | city_name character varying NOT NULL, 20 | PRIMARY KEY (city_id) 21 | ); 22 | 23 | CREATE TABLE public.cv_languages 24 | ( 25 | language_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 26 | cv_id smallint NOT NULL, 27 | language_name character varying(30) NOT NULL, 28 | language_level smallint NOT NULL, 29 | PRIMARY KEY (language_id) 30 | ); 31 | 32 | CREATE TABLE public.cvs 33 | ( 34 | cv_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 35 | user_id smallint NOT NULL, 36 | github_link character varying(255), 37 | linkedin_link character varying(255), 38 | summary text, 39 | PRIMARY KEY (cv_id) 40 | ); 41 | 42 | CREATE TABLE public.educations 43 | ( 44 | education_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 45 | cv_id smallint NOT NULL, 46 | school_name character varying(100) NOT NULL, 47 | program_name character varying(100) NOT NULL, 48 | start_date date NOT NULL, 49 | graduation_date date, 50 | PRIMARY KEY (education_id) 51 | ); 52 | 53 | CREATE TABLE public.employees 54 | ( 55 | user_id smallint NOT NULL, 56 | first_name character varying(35) NOT NULL, 57 | last_name character varying(35) NOT NULL, 58 | PRIMARY KEY (user_id) 59 | ); 60 | 61 | CREATE TABLE public.employers 62 | ( 63 | user_id smallint NOT NULL, 64 | company_name character varying(100) NOT NULL, 65 | phone_number character varying(15) NOT NULL, 66 | admin_confirm boolean NOT NULL, 67 | website character varying(50) NOT NULL, 68 | PRIMARY KEY (user_id) 69 | ); 70 | 71 | CREATE TABLE public.experiences 72 | ( 73 | experience_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 74 | cv_id smallint NOT NULL, 75 | workplace_name character varying(100) NOT NULL, 76 | job_title character varying(50) NOT NULL, 77 | start_date date NOT NULL, 78 | departure_date date, 79 | PRIMARY KEY (experience_id) 80 | ); 81 | 82 | CREATE TABLE public.job_advertisements 83 | ( 84 | advertisement_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 85 | position_id smallint NOT NULL, 86 | city_id smallint NOT NULL, 87 | job_definition text NOT NULL, 88 | min_salary numeric(10, 2), 89 | max_salary numeric(10, 2), 90 | number_of_open_positions smallint NOT NULL, 91 | created_date date NOT NULL, 92 | expiration_date date, 93 | employer_id smallint NOT NULL, 94 | is_active boolean NOT NULL, 95 | expiration_dated date, 96 | PRIMARY KEY (advertisement_id) 97 | ); 98 | 99 | CREATE TABLE public.job_positions 100 | ( 101 | position_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 102 | position_name character varying(30) NOT NULL, 103 | position_description text, 104 | PRIMARY KEY (position_id) 105 | ); 106 | 107 | CREATE TABLE public.photos 108 | ( 109 | photo_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 110 | cv_id smallint NOT NULL, 111 | title character varying(50) NOT NULL, 112 | image character varying(255) NOT NULL, 113 | created_date date NOT NULL, 114 | PRIMARY KEY (photo_id) 115 | ); 116 | 117 | CREATE TABLE public.skills 118 | ( 119 | skill_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 120 | cv_id smallint NOT NULL, 121 | skill character varying(50) NOT NULL, 122 | skill_level smallint, 123 | PRIMARY KEY (skill_id) 124 | ); 125 | 126 | CREATE TABLE public.users 127 | ( 128 | id smallint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 32767 CACHE 1 ), 129 | email character varying(50) NOT NULL, 130 | password character varying(500) NOT NULL, 131 | register_date timestamp with time zone NOT NULL, 132 | activation_code character varying(500) NOT NULL, 133 | email_comfirm boolean NOT NULL, 134 | is_active boolean NOT NULL, 135 | is_deleted boolean NOT NULL, 136 | PRIMARY KEY (id) 137 | ); 138 | 139 | ALTER TABLE public.candidates 140 | ADD FOREIGN KEY (user_id) 141 | REFERENCES public.users (id) 142 | NOT VALID; 143 | 144 | 145 | ALTER TABLE public.cities 146 | ADD FOREIGN KEY (city_id) 147 | REFERENCES public.cities (city_id) 148 | NOT VALID; 149 | 150 | 151 | ALTER TABLE public.cv_languages 152 | ADD FOREIGN KEY (cv_id) 153 | REFERENCES public.cvs (cv_id) 154 | NOT VALID; 155 | 156 | 157 | ALTER TABLE public.cvs 158 | ADD FOREIGN KEY (user_id) 159 | REFERENCES public.candidates (user_id) 160 | NOT VALID; 161 | 162 | 163 | ALTER TABLE public.educations 164 | ADD FOREIGN KEY (cv_id) 165 | REFERENCES public.cvs (cv_id) 166 | NOT VALID; 167 | 168 | 169 | ALTER TABLE public.employees 170 | ADD FOREIGN KEY (user_id) 171 | REFERENCES public.users (id) 172 | NOT VALID; 173 | 174 | 175 | ALTER TABLE public.employers 176 | ADD FOREIGN KEY (user_id) 177 | REFERENCES public.users (id) 178 | NOT VALID; 179 | 180 | 181 | ALTER TABLE public.experiences 182 | ADD FOREIGN KEY (cv_id) 183 | REFERENCES public.cvs (cv_id) 184 | NOT VALID; 185 | 186 | 187 | ALTER TABLE public.job_advertisements 188 | ADD FOREIGN KEY (city_id) 189 | REFERENCES public.cities (city_id) 190 | NOT VALID; 191 | 192 | 193 | ALTER TABLE public.job_advertisements 194 | ADD FOREIGN KEY (employer_id) 195 | REFERENCES public.employers (user_id) 196 | NOT VALID; 197 | 198 | 199 | ALTER TABLE public.job_advertisements 200 | ADD FOREIGN KEY (position_id) 201 | REFERENCES public.job_positions (position_id) 202 | NOT VALID; 203 | 204 | 205 | ALTER TABLE public.photos 206 | ADD FOREIGN KEY (cv_id) 207 | REFERENCES public.cvs (cv_id) 208 | NOT VALID; 209 | 210 | 211 | ALTER TABLE public.skills 212 | ADD FOREIGN KEY (cv_id) 213 | REFERENCES public.cvs (cv_id) 214 | NOT VALID; 215 | 216 | END; -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/HrmsApplication.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | 8 | import springfox.documentation.builders.RequestHandlerSelectors; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | @SpringBootApplication 14 | @EnableSwagger2 15 | public class HrmsApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(HrmsApplication.class, args); 19 | } 20 | 21 | @Bean 22 | public Docket api() { 23 | return new Docket(DocumentationType.SWAGGER_2) 24 | .select() 25 | .apis(RequestHandlerSelectors.basePackage("kodlamaio.hrms")) 26 | .build(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/AuthController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RequestBody; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | import kodlamaio.hrms.business.abstracts.AuthService; 10 | import kodlamaio.hrms.core.utilities.results.Result; 11 | import kodlamaio.hrms.entities.dtos.EmployerForRegisterDto; 12 | import kodlamaio.hrms.entities.dtos.CandidateForRegisterDto; 13 | import kodlamaio.hrms.entities.dtos.UserForLoginDto; 14 | 15 | @RestController 16 | @RequestMapping("/api/auth") 17 | public class AuthController { 18 | 19 | private AuthService authService; 20 | 21 | @Autowired 22 | public AuthController(AuthService authService) { 23 | this.authService = authService; 24 | } 25 | 26 | @PostMapping("/login") 27 | public Result login(@RequestBody UserForLoginDto userForLoginDto) { 28 | return authService.login(userForLoginDto); 29 | } 30 | 31 | @PostMapping("/loginCandidate") 32 | public Result loginCandidate(@RequestBody UserForLoginDto userForLoginDto) { 33 | return authService.loginCandidate(userForLoginDto); 34 | } 35 | 36 | @PostMapping("/loginemployer") 37 | public Result loginEmployer(@RequestBody UserForLoginDto userForLoginDto) { 38 | return authService.loginEmployer(userForLoginDto); 39 | } 40 | 41 | @PostMapping("/loginemployee") 42 | public Result loginEmployee(@RequestBody UserForLoginDto userForLoginDto) { 43 | return authService.loginEmployee(userForLoginDto); 44 | } 45 | 46 | @PostMapping("/employerregister") 47 | public Result registerForEmployer(@RequestBody EmployerForRegisterDto employerForRegisterDto) { 48 | return authService.employerRegister(employerForRegisterDto); 49 | } 50 | 51 | @PostMapping("/candidateRegister") 52 | public Result registerForCandidate(@RequestBody CandidateForRegisterDto candidateForRegisterDto) { 53 | return authService.candidateRegister(candidateForRegisterDto); 54 | } 55 | 56 | @PostMapping("/confirmActivation") 57 | public Result confirmActivation(@RequestBody String email, String activationCode) { 58 | return authService.confirmActivation(email, activationCode); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/CandidatesController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import kodlamaio.hrms.business.abstracts.CandidateService; 11 | import kodlamaio.hrms.core.utilities.results.DataResult; 12 | import kodlamaio.hrms.entities.concretes.Candidate; 13 | 14 | @RestController 15 | @RequestMapping("/api/candidates") 16 | public class CandidatesController { 17 | 18 | private CandidateService candidateService; 19 | 20 | @Autowired 21 | public CandidatesController(CandidateService candidateService) { 22 | super(); 23 | this.candidateService = candidateService; 24 | } 25 | 26 | @GetMapping("/getall") 27 | public DataResult> getAll(){ 28 | return this.candidateService.getAll(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/CitiesController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import kodlamaio.hrms.business.abstracts.CityService; 13 | import kodlamaio.hrms.core.utilities.results.DataResult; 14 | import kodlamaio.hrms.core.utilities.results.Result; 15 | import kodlamaio.hrms.entities.concretes.City; 16 | 17 | @RestController 18 | @RequestMapping("/api/cities") 19 | public class CitiesController { 20 | 21 | private CityService cityService; 22 | 23 | @Autowired 24 | public CitiesController(CityService cityService) { 25 | super(); 26 | this.cityService = cityService; 27 | } 28 | 29 | @GetMapping("/getall") 30 | public DataResult> getAll(){ 31 | return this.cityService.getAll(); 32 | } 33 | 34 | @PostMapping("/add") 35 | public Result add(@RequestBody City city) { 36 | return this.cityService.add(city); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/CvLanguagesController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.validation.Valid; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.validation.FieldError; 13 | import org.springframework.web.bind.MethodArgumentNotValidException; 14 | import org.springframework.web.bind.annotation.ExceptionHandler; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RequestBody; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.ResponseStatus; 19 | import org.springframework.web.bind.annotation.RestController; 20 | 21 | import kodlamaio.hrms.business.abstracts.CvLanguageService; 22 | import kodlamaio.hrms.core.utilities.results.DataResult; 23 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 24 | import kodlamaio.hrms.entities.concretes.CvLanguage; 25 | 26 | @RestController 27 | @RequestMapping("/api/cvlanguages") 28 | public class CvLanguagesController { 29 | 30 | private CvLanguageService languageService; 31 | 32 | @Autowired 33 | public CvLanguagesController(CvLanguageService languageService) { 34 | super(); 35 | this.languageService = languageService; 36 | } 37 | 38 | 39 | @PostMapping("/add") 40 | public ResponseEntity add(@Valid @RequestBody CvLanguage language) { 41 | return ResponseEntity.ok(this.languageService.add(language)); 42 | } 43 | 44 | @PostMapping("/getById") 45 | public DataResult getById(int languageId){ 46 | return languageService.getById(languageId); 47 | } 48 | 49 | @PostMapping("/getByCvId") 50 | public DataResult> getByCvId(int cvId){ 51 | return languageService.getByCvId(cvId); 52 | } 53 | 54 | @PostMapping("/getByCandidateId") 55 | public DataResult> getByCandidateId(int candidateId){ 56 | return languageService.getByCandidateId(candidateId); 57 | } 58 | 59 | @ExceptionHandler(MethodArgumentNotValidException.class) 60 | @ResponseStatus(HttpStatus.BAD_REQUEST) 61 | public ErrorDataResult handleValidationException(MethodArgumentNotValidException exceptions) { 62 | Map validationErrors = new HashMap(); 63 | for (FieldError fieldError : exceptions.getBindingResult().getFieldErrors()) { 64 | validationErrors.put(fieldError.getField(), fieldError.getDefaultMessage()); 65 | } 66 | ErrorDataResult errors = new ErrorDataResult(validationErrors, "Doğrulama hataları"); 67 | return errors; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/CvsController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.validation.Valid; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.http.ResponseEntity; 11 | import org.springframework.validation.FieldError; 12 | import org.springframework.web.bind.MethodArgumentNotValidException; 13 | import org.springframework.web.bind.annotation.ExceptionHandler; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RequestBody; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.RequestParam; 19 | import org.springframework.web.bind.annotation.ResponseStatus; 20 | import org.springframework.web.bind.annotation.RestController; 21 | import org.springframework.web.multipart.MultipartFile; 22 | 23 | import org.springframework.http.HttpStatus; 24 | 25 | import kodlamaio.hrms.business.abstracts.CvService; 26 | import kodlamaio.hrms.core.utilities.results.DataResult; 27 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 28 | import kodlamaio.hrms.entities.concretes.Cv; 29 | 30 | @RestController 31 | @RequestMapping("/api/cvs") 32 | public class CvsController { 33 | 34 | private CvService cvService; 35 | 36 | @Autowired 37 | public CvsController(CvService cvService) { 38 | super(); 39 | this.cvService = cvService; 40 | } 41 | 42 | @GetMapping("/getall") 43 | public DataResult> getAll() { 44 | return this.cvService.getAll(); 45 | } 46 | 47 | @PostMapping("/add") 48 | public ResponseEntity add(@Valid @RequestBody Cv cv) { 49 | return ResponseEntity.ok(this.cvService.add(cv)); 50 | } 51 | 52 | @PostMapping("/photoUpload") 53 | public ResponseEntity photoUpload(@RequestParam("cvId") int cvId, @RequestParam("photo") MultipartFile photo) { 54 | return ResponseEntity.ok(this.cvService.uploadCvPhoto(cvId, photo)); 55 | } 56 | 57 | @PostMapping("/getByCandidateId") 58 | public DataResult> getByCandidateId(int candidateId){ 59 | return cvService.getByCandidateId(candidateId); 60 | } 61 | 62 | @ExceptionHandler(MethodArgumentNotValidException.class) 63 | @ResponseStatus(HttpStatus.BAD_REQUEST) 64 | public ErrorDataResult handleValidationException(MethodArgumentNotValidException exceptions) { 65 | Map validationErrors = new HashMap(); 66 | for (FieldError fieldError : exceptions.getBindingResult().getFieldErrors()) { 67 | validationErrors.put(fieldError.getField(), fieldError.getDefaultMessage()); 68 | } 69 | ErrorDataResult errors = new ErrorDataResult(validationErrors, "Doğrulama hataları"); 70 | return errors; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/EducationsController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.validation.Valid; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.validation.FieldError; 13 | import org.springframework.web.bind.MethodArgumentNotValidException; 14 | import org.springframework.web.bind.annotation.ExceptionHandler; 15 | import org.springframework.web.bind.annotation.GetMapping; 16 | import org.springframework.web.bind.annotation.PostMapping; 17 | import org.springframework.web.bind.annotation.RequestBody; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.ResponseStatus; 20 | import org.springframework.web.bind.annotation.RestController; 21 | 22 | import kodlamaio.hrms.business.abstracts.EducationService; 23 | import kodlamaio.hrms.core.utilities.results.DataResult; 24 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 25 | import kodlamaio.hrms.entities.concretes.Education; 26 | 27 | @RestController 28 | @RequestMapping("/api/educations") 29 | public class EducationsController { 30 | 31 | private EducationService educationService; 32 | 33 | @Autowired 34 | public EducationsController(EducationService educationService) { 35 | super(); 36 | this.educationService = educationService; 37 | } 38 | 39 | @PostMapping("/add") 40 | public ResponseEntity add(@Valid @RequestBody Education education) { 41 | return ResponseEntity.ok(this.educationService.add(education)); 42 | } 43 | 44 | @PostMapping("/getById") 45 | public DataResult getById(int educationId){ 46 | return educationService.getById(educationId); 47 | } 48 | 49 | @GetMapping("/getOrderedByCvId") 50 | DataResult> getOrderedByCvId(int cvId){ 51 | return educationService.getByCvIdWithOrdered(cvId); 52 | } 53 | 54 | @GetMapping("/getOrderedByCandidateId") 55 | DataResult> getOrderedByCandidateId(int candidateId){ 56 | return educationService.getByCandidateIdWithOrdered(candidateId); 57 | } 58 | 59 | @ExceptionHandler(MethodArgumentNotValidException.class) 60 | @ResponseStatus(HttpStatus.BAD_REQUEST) 61 | public ErrorDataResult handleValidationException(MethodArgumentNotValidException exceptions) { 62 | Map validationErrors = new HashMap(); 63 | for (FieldError fieldError : exceptions.getBindingResult().getFieldErrors()) { 64 | validationErrors.put(fieldError.getField(), fieldError.getDefaultMessage()); 65 | } 66 | ErrorDataResult errors = new ErrorDataResult(validationErrors, "Doğrulama hataları"); 67 | return errors; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/EmployeesController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import kodlamaio.hrms.business.abstracts.EmployeeService; 11 | import kodlamaio.hrms.core.utilities.results.DataResult; 12 | import kodlamaio.hrms.entities.concretes.Employee; 13 | 14 | @RestController 15 | @RequestMapping("/api/employes") 16 | public class EmployeesController { 17 | private EmployeeService employeeService; 18 | 19 | @Autowired 20 | public EmployeesController(EmployeeService employeeService) { 21 | super(); 22 | this.employeeService = employeeService; 23 | } 24 | 25 | @GetMapping("/getall") 26 | public DataResult> getAll(){ 27 | return this.employeeService.getAll(); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/EmployersController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import kodlamaio.hrms.business.abstracts.EmployerService; 13 | import kodlamaio.hrms.core.utilities.results.DataResult; 14 | import kodlamaio.hrms.core.utilities.results.Result; 15 | import kodlamaio.hrms.entities.concretes.Employer; 16 | 17 | @RestController 18 | @RequestMapping("/api/employers") 19 | public class EmployersController { 20 | 21 | private EmployerService employerService; 22 | 23 | @Autowired 24 | public EmployersController(EmployerService employerService) { 25 | super(); 26 | this.employerService = employerService; 27 | } 28 | 29 | @GetMapping("/getall") 30 | public DataResult> getAll(){ 31 | return this.employerService.getAll(); 32 | } 33 | 34 | @PostMapping("/verifyByAdmin") 35 | public Result add(@RequestBody Employer employer){ 36 | return this.employerService.verifyByAdmin(employer); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/ExperiencesController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.validation.Valid; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.validation.FieldError; 13 | import org.springframework.web.bind.MethodArgumentNotValidException; 14 | import org.springframework.web.bind.annotation.ExceptionHandler; 15 | import org.springframework.web.bind.annotation.GetMapping; 16 | import org.springframework.web.bind.annotation.PostMapping; 17 | import org.springframework.web.bind.annotation.RequestBody; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.ResponseStatus; 20 | import org.springframework.web.bind.annotation.RestController; 21 | 22 | import kodlamaio.hrms.business.abstracts.ExperienceService; 23 | import kodlamaio.hrms.core.utilities.results.DataResult; 24 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 25 | import kodlamaio.hrms.entities.concretes.Experience; 26 | 27 | @RestController 28 | @RequestMapping("/api/experiences") 29 | public class ExperiencesController { 30 | private ExperienceService experienceService; 31 | 32 | @Autowired 33 | public ExperiencesController(ExperienceService experienceService) { 34 | super(); 35 | this.experienceService = experienceService; 36 | } 37 | 38 | @PostMapping("/add") 39 | public ResponseEntity add(@Valid @RequestBody Experience experience) { 40 | return ResponseEntity.ok(this.experienceService.add(experience)); 41 | } 42 | 43 | @PostMapping("/getById") 44 | public DataResult getById(int experienceId){ 45 | return experienceService.getById(experienceId); 46 | } 47 | 48 | @GetMapping("/getOrderedByCvId") 49 | DataResult> getOrderedByCvId(int cvId){ 50 | return experienceService.getByCvIdWithOrdered(cvId); 51 | } 52 | 53 | @GetMapping("/getOrderedByCandidateId") 54 | DataResult> getOrderedByCandidateId(int candidateId){ 55 | return experienceService.getByCandidateIdWithOrdered(candidateId); 56 | } 57 | 58 | @ExceptionHandler(MethodArgumentNotValidException.class) 59 | @ResponseStatus(HttpStatus.BAD_REQUEST) 60 | public ErrorDataResult handleValidationException(MethodArgumentNotValidException exceptions) { 61 | Map validationErrors = new HashMap(); 62 | for (FieldError fieldError : exceptions.getBindingResult().getFieldErrors()) { 63 | validationErrors.put(fieldError.getField(), fieldError.getDefaultMessage()); 64 | } 65 | ErrorDataResult errors = new ErrorDataResult(validationErrors, "Doğrulama hataları"); 66 | return errors; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/JobAdvertisementsController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.time.LocalDate; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import kodlamaio.hrms.business.abstracts.JobAdvertisementService; 15 | import kodlamaio.hrms.core.utilities.results.DataResult; 16 | import kodlamaio.hrms.core.utilities.results.Result; 17 | import kodlamaio.hrms.entities.concretes.JobAdvertisement; 18 | import kodlamaio.hrms.entities.dtos.JobAdvertisementDto; 19 | 20 | @RestController 21 | @RequestMapping("/api/jobadvertisements") 22 | public class JobAdvertisementsController { 23 | 24 | private JobAdvertisementService jobAdvertisementService; 25 | 26 | @Autowired 27 | public JobAdvertisementsController(JobAdvertisementService jobAdvertisementService) { 28 | super(); 29 | this.jobAdvertisementService = jobAdvertisementService; 30 | } 31 | 32 | @PostMapping("/add") 33 | public Result add(@RequestBody JobAdvertisement jobAdvertisement) { 34 | return this.jobAdvertisementService.add(jobAdvertisement); 35 | } 36 | 37 | @PostMapping("/setAdvertisementStatus") 38 | public Result setAdvertisementStatus(@RequestParam int jobAdvertisementId, boolean status) { 39 | return this.jobAdvertisementService.setAdvertisementStatus(jobAdvertisementId, status); 40 | } 41 | 42 | @GetMapping("/getall") 43 | public DataResult> getAll() { 44 | return this.jobAdvertisementService.getAll(); 45 | } 46 | 47 | @GetMapping("/getActiveAdvertisements") 48 | public DataResult> getActiveAdvertisements() { 49 | return this.jobAdvertisementService.getActiveAdvertisements(); 50 | } 51 | 52 | @GetMapping("/getActiveAdvertisementsByCreatedDate") 53 | public DataResult> getActiveAdvertisementsByCreatedDate(LocalDate date) { 54 | return this.jobAdvertisementService.getActiveAdvertisementsByCreatedDate(date); 55 | } 56 | 57 | @GetMapping("/getActiveAdvertisementsByExpirationDate") 58 | public DataResult> getActiveAdvertisementsByExpirationDate(LocalDate date) { 59 | return this.jobAdvertisementService.getActiveAdvertisementsByExpirationDate(date); 60 | } 61 | 62 | @GetMapping("/getActiveAdvertisementsByEmployerId") 63 | public DataResult> getActiveAdvertisementsByEmployerId(int employerId) { 64 | return this.jobAdvertisementService.getActiveAdvertisementsByEmployerId(employerId); 65 | } 66 | 67 | @GetMapping("/getActiveAdvertisementsSortByCompany") 68 | public DataResult> getActiveAdvertisementsSortByCompany(boolean isDesc) { 69 | return this.jobAdvertisementService.getActiveAdvertisementsSortBy("employer.companyName", isDesc); 70 | } 71 | 72 | @GetMapping("/getActiveAdvertisementsSortByCreatedDate") 73 | public DataResult> getActiveAdvertisementsSortByCreatedDate(boolean isDesc) { 74 | return this.jobAdvertisementService.getActiveAdvertisementsSortBy("createdDate", isDesc); 75 | } 76 | 77 | @GetMapping("/getActiveAdvertisementsSortByExpirationDate") 78 | public DataResult> getActiveAdvertisementsSortByExpirationDate(boolean isDesc) { 79 | return this.jobAdvertisementService.getActiveAdvertisementsSortBy("expirationDate", isDesc); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/JobPositionsController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import kodlamaio.hrms.business.abstracts.JobPositionService; 13 | import kodlamaio.hrms.core.utilities.results.DataResult; 14 | import kodlamaio.hrms.core.utilities.results.Result; 15 | 16 | import kodlamaio.hrms.entities.concretes.JobPosition; 17 | 18 | @RestController 19 | @RequestMapping("/api/jobpositions") 20 | public class JobPositionsController { 21 | 22 | private JobPositionService jobPositionService; 23 | 24 | @Autowired 25 | public JobPositionsController(JobPositionService jobPositionService) { 26 | super(); 27 | this.jobPositionService = jobPositionService; 28 | } 29 | 30 | @GetMapping("/getall") 31 | public DataResult> getAll(){ 32 | return this.jobPositionService.getAll(); 33 | } 34 | 35 | @PostMapping("/add") 36 | public Result add(@RequestBody JobPosition jobPosition){ 37 | return this.jobPositionService.add(jobPosition); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/PhotosController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.HttpStatus; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.validation.FieldError; 11 | import org.springframework.web.bind.MethodArgumentNotValidException; 12 | import org.springframework.web.bind.annotation.ExceptionHandler; 13 | import org.springframework.web.bind.annotation.PostMapping; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | import org.springframework.web.bind.annotation.ResponseStatus; 17 | import org.springframework.web.bind.annotation.RestController; 18 | import org.springframework.web.multipart.MultipartFile; 19 | 20 | import kodlamaio.hrms.business.abstracts.PhotoService; 21 | import kodlamaio.hrms.core.utilities.results.DataResult; 22 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 23 | import kodlamaio.hrms.entities.concretes.Photo; 24 | 25 | @RestController 26 | @RequestMapping("/api/photos") 27 | public class PhotosController { 28 | 29 | private PhotoService photoService; 30 | 31 | @Autowired 32 | public PhotosController(PhotoService photoService) { 33 | super(); 34 | this.photoService = photoService; 35 | } 36 | 37 | @PostMapping("/photoUpload") 38 | public ResponseEntity photoUpload(@RequestParam("cvId") int cvId, @RequestParam("photo") MultipartFile photo) { 39 | return ResponseEntity.ok(this.photoService.upload(photo,cvId)); 40 | } 41 | 42 | @PostMapping("/getById") 43 | public DataResult getById(int photoId){ 44 | return photoService.getById(photoId); 45 | } 46 | 47 | @PostMapping("/getByCvId") 48 | public DataResult> getByCvId(int cvId){ 49 | return photoService.getByCvId(cvId); 50 | } 51 | 52 | @PostMapping("/getByCandidateId") 53 | public DataResult> getByCandidateId(int candidateId){ 54 | return photoService.getByCandidateId(candidateId); 55 | } 56 | 57 | @ExceptionHandler(MethodArgumentNotValidException.class) 58 | @ResponseStatus(HttpStatus.BAD_REQUEST) 59 | public ErrorDataResult handleValidationException(MethodArgumentNotValidException exceptions) { 60 | Map validationErrors = new HashMap(); 61 | for (FieldError fieldError : exceptions.getBindingResult().getFieldErrors()) { 62 | validationErrors.put(fieldError.getField(), fieldError.getDefaultMessage()); 63 | } 64 | ErrorDataResult errors = new ErrorDataResult(validationErrors, "Doğrulama hataları"); 65 | return errors; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/api/controllers/SkillsController.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.api.controllers; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.validation.Valid; 8 | 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.http.ResponseEntity; 11 | import org.springframework.validation.FieldError; 12 | import org.springframework.web.bind.MethodArgumentNotValidException; 13 | import org.springframework.web.bind.annotation.ExceptionHandler; 14 | import org.springframework.web.bind.annotation.PostMapping; 15 | import org.springframework.web.bind.annotation.RequestBody; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.ResponseStatus; 18 | import org.springframework.web.bind.annotation.RestController; 19 | 20 | import kodlamaio.hrms.business.abstracts.SkillService; 21 | import kodlamaio.hrms.core.utilities.results.DataResult; 22 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 23 | import kodlamaio.hrms.entities.concretes.Skill; 24 | 25 | @RestController 26 | @RequestMapping("/api/skills") 27 | public class SkillsController { 28 | 29 | 30 | private SkillService skillService; 31 | 32 | public SkillsController(SkillService skillService) { 33 | super(); 34 | this.skillService = skillService; 35 | } 36 | 37 | @PostMapping("/add") 38 | public ResponseEntity add(@Valid @RequestBody Skill skill) { 39 | return ResponseEntity.ok(this.skillService.add(skill)); 40 | } 41 | 42 | @PostMapping("/getById") 43 | public DataResult getById(int skillId){ 44 | return skillService.getById(skillId); 45 | } 46 | 47 | @PostMapping("/getByCvId") 48 | public DataResult> getByCvId(int cvId){ 49 | return skillService.getByCvId(cvId); 50 | } 51 | 52 | @PostMapping("/getByCandidateId") 53 | public DataResult> getByCandidateId(int candidateId){ 54 | return skillService.getByCandidateId(candidateId); 55 | } 56 | 57 | @ExceptionHandler(MethodArgumentNotValidException.class) 58 | @ResponseStatus(HttpStatus.BAD_REQUEST) 59 | public ErrorDataResult handleValidationException(MethodArgumentNotValidException exceptions) { 60 | Map validationErrors = new HashMap(); 61 | for (FieldError fieldError : exceptions.getBindingResult().getFieldErrors()) { 62 | validationErrors.put(fieldError.getField(), fieldError.getDefaultMessage()); 63 | } 64 | ErrorDataResult errors = new ErrorDataResult(validationErrors, "Doğrulama hataları"); 65 | return errors; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/ActivationService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import kodlamaio.hrms.core.utilities.results.Result; 4 | 5 | public interface ActivationService { 6 | Result sendActivationCode(String sendTo, String activationCode); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/AuthService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import kodlamaio.hrms.core.utilities.results.Result; 4 | import kodlamaio.hrms.entities.dtos.EmployerForRegisterDto; 5 | import kodlamaio.hrms.entities.dtos.CandidateForRegisterDto; 6 | import kodlamaio.hrms.entities.dtos.UserForLoginDto; 7 | 8 | public interface AuthService { 9 | 10 | Result login(UserForLoginDto userForLoginDto); 11 | Result loginEmployee(UserForLoginDto userForLoginDto); 12 | Result loginCandidate(UserForLoginDto userForLoginDto); 13 | Result loginEmployer(UserForLoginDto userForLoginDto); 14 | Result employerRegister(EmployerForRegisterDto employerForRegisterDto); 15 | Result candidateRegister(CandidateForRegisterDto candidateForRegisterDto); 16 | 17 | Result confirmActivation(String email, String activationCode); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/CandidateService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.Candidate; 8 | 9 | public interface CandidateService { 10 | DataResult> getAll(); 11 | Result add(Candidate candidate); 12 | Result validate(Candidate candidate); 13 | Result checkLogin(String email, String password); 14 | boolean checkIfExistsUserByNationalityId(String nationalityId); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/CheckRealPersonService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import kodlamaio.hrms.entities.abstracts.ValidatableUser; 4 | 5 | public interface CheckRealPersonService { 6 | boolean validate(ValidatableUser user); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/CityService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.City; 8 | 9 | public interface CityService { 10 | Result add(City city); 11 | DataResult> getAll(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/CvLanguageService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.CvLanguage; 8 | 9 | public interface CvLanguageService { 10 | Result add(CvLanguage cvLanguage); 11 | DataResult> getByCvId(int cvId); 12 | DataResult getById(int languageId); 13 | DataResult> getByCandidateId(int candidateId); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/CvService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.web.multipart.MultipartFile; 6 | 7 | import kodlamaio.hrms.core.utilities.results.DataResult; 8 | import kodlamaio.hrms.core.utilities.results.Result; 9 | import kodlamaio.hrms.entities.concretes.Cv; 10 | import kodlamaio.hrms.entities.concretes.Photo; 11 | 12 | public interface CvService { 13 | Result add(Cv cv); 14 | DataResult> getAll(); 15 | DataResult> getByCandidateId(int candidateId); 16 | DataResult uploadCvPhoto(int cvId, MultipartFile photo); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/EducationService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.Education; 8 | 9 | public interface EducationService { 10 | 11 | Result add(Education education); 12 | DataResult> getByCvIdWithOrdered(int cvId); 13 | DataResult> getByCandidateIdWithOrdered(int candidateId); 14 | DataResult getById(int educationId); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/EmployeeService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.Employee; 8 | 9 | public interface EmployeeService { 10 | DataResult> getAll(); 11 | Result add(Employee employee); 12 | Result checkLogin(String email, String password); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/EmployerService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.Employer; 8 | 9 | public interface EmployerService { 10 | DataResult> getAll(); 11 | Result add(Employer employer); 12 | 13 | Result checkLogin(String email, String password); 14 | Result validate(Employer employer); 15 | Result verifyByAdmin(Employer employer); 16 | boolean isActive(int employerId); 17 | } -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/ExperienceService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.Experience; 8 | 9 | public interface ExperienceService { 10 | 11 | Result add(Experience experience); 12 | DataResult> getByCvIdWithOrdered(int cvId); 13 | DataResult> getByCandidateIdWithOrdered(int candidateId); 14 | DataResult getById(int experienceId); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/JobAdvertisementService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.time.LocalDate; 4 | import java.util.List; 5 | 6 | import kodlamaio.hrms.core.utilities.results.DataResult; 7 | import kodlamaio.hrms.core.utilities.results.Result; 8 | import kodlamaio.hrms.entities.concretes.JobAdvertisement; 9 | import kodlamaio.hrms.entities.dtos.JobAdvertisementDto; 10 | 11 | public interface JobAdvertisementService { 12 | Result add(JobAdvertisement jobAdvertisement); 13 | Result setAdvertisementStatus(int advertisementId, boolean status); 14 | DataResult> getAll(); 15 | DataResult> getActiveAdvertisements(); 16 | DataResult> getActiveAdvertisementsSortBy(String fieldName, boolean isDesc); 17 | DataResult> getActiveAdvertisementsByCreatedDate(LocalDate date); 18 | DataResult> getActiveAdvertisementsByExpirationDate(LocalDate date); 19 | DataResult> getActiveAdvertisementsByEmployerId(int employerId); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/JobPositionService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.JobPosition; 8 | 9 | public interface JobPositionService { 10 | DataResult> getAll(); 11 | Result add(JobPosition jobPosition); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/PhotoService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.web.multipart.MultipartFile; 6 | 7 | import kodlamaio.hrms.core.utilities.results.DataResult; 8 | import kodlamaio.hrms.core.utilities.results.Result; 9 | import kodlamaio.hrms.entities.concretes.Photo; 10 | 11 | public interface PhotoService { 12 | Result add(Photo photo); 13 | DataResult> getByCvId(int cvId); 14 | DataResult upload(MultipartFile photo, int cvId); 15 | DataResult> getByCandidateId(int candidateId); 16 | DataResult getById(int photoId); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/SkillService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.Skill; 8 | 9 | public interface SkillService { 10 | 11 | Result add(Skill skill); 12 | DataResult> getByCvId(int cvId); 13 | DataResult getById(int skillId); 14 | DataResult> getByCandidateId(int candidateId); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/UserService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.entities.concretes.User; 8 | 9 | public interface UserService { 10 | DataResult> getAll(); 11 | DataResult getByEmail(String email); 12 | Result add(User user); 13 | Result confirmActivation(String email, String activationCode); 14 | Result checkLogin(String email, String password); 15 | boolean checkIfExistsUserByEmail(String email); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/abstracts/UserValidationService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import kodlamaio.hrms.core.utilities.results.DataResult; 6 | 7 | public interface UserValidationService { 8 | 9 | DataResult> validate(T user); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/adapters/MernisServiceAdapter.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.adapters; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import kodlamaio.hrms.business.abstracts.CheckRealPersonService; 6 | import kodlamaio.hrms.entities.abstracts.ValidatableUser; 7 | 8 | @Service 9 | public class MernisServiceAdapter implements CheckRealPersonService { 10 | 11 | 12 | @Override 13 | public boolean validate(ValidatableUser user) { 14 | // TODO Use mernis validation service with KPSPublicSoap 15 | boolean fakeResult = true; 16 | return fakeResult; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/adapters/cloudinary/CloudinaryAdapterService.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.adapters.cloudinary; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.web.multipart.MultipartFile; 12 | 13 | import com.cloudinary.Cloudinary; 14 | import com.cloudinary.utils.ObjectUtils; 15 | 16 | import kodlamaio.hrms.core.utilities.helpers.PhotoUploadHelper; 17 | import kodlamaio.hrms.core.utilities.results.DataResult; 18 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 19 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 20 | 21 | @Service 22 | public class CloudinaryAdapterService implements PhotoUploadHelper { 23 | 24 | private Cloudinary cloudinary; 25 | 26 | 27 | @Autowired 28 | public CloudinaryAdapterService() { 29 | Map valuesMap = new HashMap<>(); 30 | valuesMap.put("cloud_name","Input your cloud name" ); 31 | valuesMap.put("api_key", "Input your Cloudinary api key" ); 32 | valuesMap.put("api_secret","Input your Cloudinary secret key" ); 33 | cloudinary = new Cloudinary(valuesMap); 34 | } 35 | 36 | public DataResult> upload(MultipartFile multipartFile) { 37 | File file; 38 | try { 39 | file = convert(multipartFile); 40 | Map result = cloudinary.uploader().upload(file, ObjectUtils.emptyMap()); 41 | file.delete(); 42 | return new SuccessDataResult>(result); 43 | } catch (IOException e) { 44 | e.printStackTrace(); 45 | return new ErrorDataResult>("Dosya yüklenemedi"); 46 | } 47 | } 48 | 49 | public DataResult delete (String id) throws IOException { 50 | Map result = cloudinary.uploader().destroy(id,ObjectUtils.emptyMap()); 51 | return new SuccessDataResult(result); 52 | } 53 | 54 | 55 | private File convert(MultipartFile multipartFile) throws IOException { 56 | File file = new File(multipartFile.getOriginalFilename()); 57 | FileOutputStream stream = new FileOutputStream(file); 58 | stream.write(multipartFile.getBytes()); 59 | stream.close(); 60 | 61 | return file; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/AuthManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.ActivationService; 9 | import kodlamaio.hrms.business.abstracts.AuthService; 10 | import kodlamaio.hrms.business.abstracts.CheckRealPersonService; 11 | import kodlamaio.hrms.business.abstracts.EmployerService; 12 | import kodlamaio.hrms.business.abstracts.CandidateService; 13 | import kodlamaio.hrms.business.abstracts.UserService; 14 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 15 | import kodlamaio.hrms.core.utilities.results.Result; 16 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 17 | import kodlamaio.hrms.entities.concretes.Employer; 18 | import kodlamaio.hrms.entities.concretes.Candidate; 19 | import kodlamaio.hrms.entities.dtos.EmployerForRegisterDto; 20 | import kodlamaio.hrms.entities.dtos.CandidateForRegisterDto; 21 | import kodlamaio.hrms.entities.dtos.UserForLoginDto; 22 | import kodlamaio.hrms.business.constants.Messages; 23 | 24 | @Service 25 | public class AuthManager implements AuthService { 26 | 27 | private UserService userService; 28 | private EmployerService employerService; 29 | private CandidateService candidateService; 30 | private CheckRealPersonService checkRealPersonService; 31 | private ActivationService activationService; 32 | 33 | @Autowired 34 | public AuthManager(UserService userService, 35 | EmployerService employerService, 36 | CandidateService candidateService, 37 | CheckRealPersonService checkRealPersonService, 38 | ActivationService activationService) { 39 | super(); 40 | this.userService = userService; 41 | this.employerService = employerService; 42 | this.candidateService = candidateService; 43 | this.checkRealPersonService = checkRealPersonService; 44 | this.activationService = activationService; 45 | 46 | } 47 | 48 | @Override 49 | public Result login(UserForLoginDto userForLoginDto) { 50 | return userService.checkLogin(userForLoginDto.getEmail(), userForLoginDto.getPassword()); 51 | } 52 | 53 | @Override 54 | public Result loginCandidate(UserForLoginDto userForLoginDto) { 55 | return candidateService.checkLogin(userForLoginDto.getEmail(), userForLoginDto.getPassword()); 56 | } 57 | 58 | @Override 59 | public Result loginEmployee(UserForLoginDto userForLoginDto) { 60 | //TODO Coding login for Employee 61 | //return employeeService.checkLogin(userForLoginDto.getEmail(), userForLoginDto.getPassword());; 62 | return null; 63 | } 64 | 65 | @Override 66 | public Result loginEmployer(UserForLoginDto userForLoginDto) { 67 | return employerService.checkLogin(userForLoginDto.getEmail(), userForLoginDto.getPassword()); 68 | } 69 | 70 | @Override 71 | public Result employerRegister(EmployerForRegisterDto employerForRegisterDto) { 72 | 73 | Employer employer = new Employer(); 74 | employer.setEmail(employerForRegisterDto.getEmail()); 75 | employer.setCompanyName(employerForRegisterDto.getCompanyName()); 76 | employer.setWebsite(employerForRegisterDto.getWebsite()); 77 | employer.setPhoneNumber(employerForRegisterDto.getPhoneNumber()); 78 | employer.setPassword(employerForRegisterDto.getPassword()); 79 | var validateResult = validateEmployer(employer); 80 | if(!validateResult.isSuccess()) { 81 | return new ErrorResult(validateResult.getMessage()); 82 | } 83 | 84 | if(userExists(employer.getEmail())) { 85 | return new ErrorResult(Messages.userExists); 86 | } 87 | 88 | 89 | employer.setActivationCode(createActivationCode(employer.getEmail())); 90 | 91 | var resultAdd = this.employerService.add(employer); 92 | if(resultAdd.isSuccess()) { 93 | var resultSend = activationService.sendActivationCode(employer.getEmail(), employer.getActivationCode()).isSuccess(); 94 | if(resultSend) { 95 | return new SuccessResult(Messages.saveUserAndSendCode); 96 | }else { 97 | return new SuccessResult(Messages.saveUserButNotSendCode); 98 | } 99 | } 100 | return new ErrorResult(resultAdd.getMessage()); 101 | } 102 | 103 | @Override 104 | public Result candidateRegister(CandidateForRegisterDto candidateForRegisterDto) { 105 | int year = (candidateForRegisterDto.getYearOfBirth() == null)? 0 : candidateForRegisterDto.getYearOfBirth(); 106 | Candidate candidate = new Candidate( 107 | candidateForRegisterDto.getFirstName(), 108 | candidateForRegisterDto.getLastName(), 109 | candidateForRegisterDto.getNationalityId(), 110 | year, 111 | candidateForRegisterDto.getEmail(), 112 | candidateForRegisterDto.getPassword() 113 | ); 114 | 115 | var validateResult = validateCandidate(candidate); 116 | if(!validateResult.isSuccess()) { 117 | return new ErrorResult(validateResult.getMessage()); 118 | } 119 | 120 | if(!isPasswordMatch(candidateForRegisterDto.getPassword(),candidateForRegisterDto.getRepassword())) { 121 | return new ErrorResult(Messages.passwordsNotMatch); 122 | } 123 | 124 | if(userExists(candidate.getEmail()) || nationalityIdExists(candidate.getNationalityId())) { 125 | return new ErrorResult(Messages.userExists); 126 | } 127 | 128 | if(!checkIfRealPerson(candidateForRegisterDto)) { 129 | return new ErrorResult(Messages.NotRealPerson); 130 | } 131 | 132 | candidate.setActivationCode(createActivationCode(candidate.getEmail())); 133 | 134 | var resultAdd = candidateService.add(candidate); 135 | if(resultAdd.isSuccess()) { 136 | var resultSend = activationService.sendActivationCode(candidate.getEmail(), candidate.getActivationCode()).isSuccess(); 137 | if(resultSend) { 138 | return new SuccessResult(Messages.saveUserAndSendCode); 139 | }else { 140 | return new SuccessResult(Messages.saveUserButNotSendCode); 141 | } 142 | } 143 | return new ErrorResult(resultAdd.getMessage()); 144 | } 145 | 146 | 147 | private boolean userExists(String email) { 148 | return userService.checkIfExistsUserByEmail(email); 149 | } 150 | 151 | 152 | private boolean nationalityIdExists(String nationalityId) { 153 | return candidateService.checkIfExistsUserByNationalityId(nationalityId); 154 | } 155 | 156 | private Result validateCandidate(Candidate candidate) { 157 | 158 | return candidateService.validate(candidate); 159 | 160 | } 161 | 162 | private Result validateEmployer(Employer employer) { 163 | 164 | return employerService.validate(employer); 165 | 166 | } 167 | 168 | private boolean isPasswordMatch(String password, String repassword) { 169 | return password.equals(repassword); 170 | } 171 | 172 | private boolean checkIfRealPerson(CandidateForRegisterDto candidate) { 173 | 174 | return checkRealPersonService.validate(candidate); 175 | } 176 | 177 | private String createActivationCode(String email) { 178 | // TODO Hashing with Email 179 | UUID uuid = UUID.randomUUID(); 180 | return uuid.toString(); 181 | } 182 | 183 | @Override 184 | public Result confirmActivation(String email, String activationCode) { 185 | return userService.confirmActivation(email, activationCode); 186 | } 187 | 188 | } 189 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/CandidateManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.CandidateService; 9 | import kodlamaio.hrms.business.abstracts.UserValidationService; 10 | import kodlamaio.hrms.business.constants.Messages; 11 | import kodlamaio.hrms.core.utilities.results.DataResult; 12 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 13 | import kodlamaio.hrms.core.utilities.results.Result; 14 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 15 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 16 | import kodlamaio.hrms.dataAccess.abstracts.CandidateDao; 17 | import kodlamaio.hrms.entities.concretes.Candidate; 18 | 19 | @Service 20 | public class CandidateManager implements CandidateService { 21 | 22 | private CandidateDao candidateDao; 23 | private UserValidationService validationService; 24 | 25 | @Autowired 26 | public CandidateManager(CandidateDao candidateDao, UserValidationService validationService) { 27 | super(); 28 | this.candidateDao = candidateDao; 29 | this.validationService = validationService; 30 | } 31 | 32 | @Override 33 | public DataResult> getAll() { 34 | return new SuccessDataResult> 35 | (this.candidateDao.findAll()); 36 | } 37 | 38 | @Override 39 | public Result add(Candidate candidate) { 40 | 41 | var result = this.candidateDao.save(candidate); 42 | if(result != null) { 43 | return new SuccessResult(Messages.userAddedSuccess); 44 | } 45 | return new ErrorResult(); 46 | } 47 | 48 | @Override 49 | public Result validate(Candidate candidate) { 50 | var errors = validationService.validate(candidate); 51 | 52 | if(errors != null) { 53 | String message = ""; 54 | for (String error : errors.getData()) { 55 | message += error + "\n"; 56 | } 57 | return new ErrorResult(message); 58 | } 59 | return new SuccessResult(); 60 | } 61 | 62 | @Override 63 | public Result checkLogin(String email, String password) { 64 | Candidate candidate = this.candidateDao.findCandidateByEmailAndPassword(email, password); 65 | if(candidate != null) { 66 | if(candidate.isActive() && !candidate.isDeleted()) { 67 | return new SuccessResult(); 68 | } 69 | } 70 | return new ErrorResult(); 71 | 72 | } 73 | 74 | @Override 75 | public boolean checkIfExistsUserByNationalityId(String nationalityId) { 76 | return candidateDao.existsByNationalityId(nationalityId); 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/CandidateValidationManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.regex.Pattern; 6 | 7 | import org.springframework.stereotype.Service; 8 | 9 | import kodlamaio.hrms.business.abstracts.UserValidationService; 10 | import kodlamaio.hrms.core.utilities.results.DataResult; 11 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 12 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 13 | import kodlamaio.hrms.core.utilities.results.Result; 14 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 15 | import kodlamaio.hrms.entities.concretes.Candidate; 16 | import kodlamaio.hrms.business.constants.Messages; 17 | 18 | @Service 19 | public class CandidateValidationManager implements UserValidationService { 20 | 21 | private List errors = new ArrayList(); 22 | 23 | @Override 24 | public DataResult> validate(Candidate candidate) { 25 | errors.clear(); 26 | if(checkIsNotNull("Email", candidate.getEmail()).isSuccess()) { 27 | checkEmailPattern(candidate.getEmail()); 28 | } 29 | checkIsNotNull("First Name", candidate.getFirstName()); 30 | checkIsNotNull("Last Name", candidate.getLastName()); 31 | if(checkIsNotNull("Nationality Id", candidate.getNationalityId()).isSuccess()) { 32 | isTCKN(candidate.getNationalityId()); 33 | } 34 | if(checkIsNotNull("Year of Birth Date", String.valueOf(candidate.getYearOfBirth())).isSuccess()) { 35 | isYear(candidate.getYearOfBirth()); 36 | } 37 | if(!this.errors.isEmpty()) { 38 | return new ErrorDataResult>(errors); 39 | } 40 | return null; 41 | } 42 | 43 | private Result checkIsNotNull(String fieldName, String value) { 44 | if (value == null || value.isBlank()) { 45 | errors.add(fieldName + Messages.canNotNull); 46 | return new ErrorResult(); 47 | } 48 | return new SuccessResult(); 49 | } 50 | 51 | private Result isYear(int value) { 52 | Pattern pattern = Pattern.compile("^(19|20)\\d{2}$"); 53 | boolean result = pattern.matcher(String.valueOf(value)).matches(); 54 | if (!result) { 55 | errors.add(Messages.invalidYearOfBirth); 56 | return new ErrorResult(); 57 | } 58 | return new SuccessResult(); 59 | } 60 | 61 | private Result checkEmailPattern(String email) { 62 | 63 | Pattern pattern = Pattern.compile( 64 | "^[a-zA-Z0-9_!#$%&’*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$"); 65 | boolean result = pattern.matcher(email).matches(); 66 | if (!result) { 67 | errors.add(Messages.invalidEmail); 68 | return new ErrorResult(); 69 | } 70 | return new SuccessResult(); 71 | } 72 | 73 | private Result isTCKN(String tckn) { 74 | 75 | Pattern pattern = Pattern.compile("^[1-9]{1}[0-9]{9}[02468]{1}$"); 76 | boolean result = pattern.matcher(tckn).matches(); 77 | if (!result) { 78 | errors.add(Messages.invalidTCKNo); 79 | return new ErrorResult(); 80 | } 81 | return new SuccessResult(); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/CityManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.CityService; 9 | import kodlamaio.hrms.business.constants.Messages; 10 | import kodlamaio.hrms.core.utilities.results.DataResult; 11 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 12 | import kodlamaio.hrms.core.utilities.results.Result; 13 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 14 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 15 | import kodlamaio.hrms.dataAccess.abstracts.CityDao; 16 | import kodlamaio.hrms.entities.concretes.City; 17 | 18 | @Service 19 | public class CityManager implements CityService { 20 | 21 | private CityDao cityDao; 22 | 23 | @Autowired 24 | public CityManager(CityDao cityDao) { 25 | super(); 26 | this.cityDao = cityDao; 27 | } 28 | 29 | @Override 30 | public Result add(City city) { 31 | var result = this.cityDao.save(city); 32 | if(result != null) { 33 | return new SuccessResult(Messages.cityAddedSuccess); 34 | } 35 | return new ErrorResult(); 36 | } 37 | 38 | @Override 39 | public DataResult> getAll() { 40 | return new SuccessDataResult> 41 | (this.cityDao.findAll(), Messages.listedData); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/CvLanguageManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.CvLanguageService; 9 | import kodlamaio.hrms.core.utilities.results.DataResult; 10 | import kodlamaio.hrms.core.utilities.results.Result; 11 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 12 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 13 | import kodlamaio.hrms.dataAccess.abstracts.CvLanguageDao; 14 | import kodlamaio.hrms.entities.concretes.CvLanguage; 15 | 16 | @Service 17 | public class CvLanguageManager implements CvLanguageService { 18 | 19 | private CvLanguageDao cvLanguageDao; 20 | 21 | @Autowired 22 | public CvLanguageManager(CvLanguageDao cvLanguageDao) { 23 | super(); 24 | this.cvLanguageDao = cvLanguageDao; 25 | } 26 | 27 | @Override 28 | public Result add(CvLanguage cvLanguage) { 29 | this.cvLanguageDao.save(cvLanguage); 30 | return new SuccessResult(); 31 | } 32 | 33 | @Override 34 | public DataResult> getByCvId(int cvId) { 35 | return new SuccessDataResult>(this.cvLanguageDao.getByCvId(cvId)); 36 | } 37 | 38 | @Override 39 | public DataResult getById(int languageId) { 40 | return new SuccessDataResult(this.cvLanguageDao.getById(languageId)); 41 | } 42 | 43 | @Override 44 | public DataResult> getByCandidateId(int candidateId) { 45 | return new SuccessDataResult>(this.cvLanguageDao.getByCandidateId(candidateId)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/CvManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.web.multipart.MultipartFile; 8 | 9 | import kodlamaio.hrms.business.abstracts.CvLanguageService; 10 | import kodlamaio.hrms.business.abstracts.CvService; 11 | import kodlamaio.hrms.business.abstracts.EducationService; 12 | import kodlamaio.hrms.business.abstracts.ExperienceService; 13 | import kodlamaio.hrms.business.abstracts.PhotoService; 14 | import kodlamaio.hrms.business.abstracts.SkillService; 15 | import kodlamaio.hrms.core.utilities.results.DataResult; 16 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 17 | import kodlamaio.hrms.core.utilities.results.Result; 18 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 19 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 20 | import kodlamaio.hrms.dataAccess.abstracts.CvDao; 21 | import kodlamaio.hrms.entities.concretes.Cv; 22 | import kodlamaio.hrms.entities.concretes.CvLanguage; 23 | import kodlamaio.hrms.entities.concretes.Education; 24 | import kodlamaio.hrms.entities.concretes.Experience; 25 | import kodlamaio.hrms.entities.concretes.Photo; 26 | import kodlamaio.hrms.entities.concretes.Skill; 27 | 28 | @Service 29 | public class CvManager implements CvService { 30 | 31 | private CvDao cvDao; 32 | private CvLanguageService cvLanguageService; 33 | private EducationService educationService; 34 | private ExperienceService experienceService; 35 | private SkillService skillService; 36 | private PhotoService photoService; 37 | 38 | @Autowired 39 | public CvManager(CvDao cvDao, CvLanguageService cvLanguageService, EducationService educationService, 40 | ExperienceService experienceService, SkillService skillService, PhotoService photoService) { 41 | super(); 42 | this.cvDao = cvDao; 43 | this.cvLanguageService = cvLanguageService; 44 | this.educationService = educationService; 45 | this.experienceService = experienceService; 46 | this.skillService = skillService; 47 | this.photoService = photoService; 48 | } 49 | 50 | @Override 51 | public Result add(Cv cv) { 52 | var addedCv = this.cvDao.save(cv); 53 | if (addedCv != null) { 54 | 55 | if (addedCv.getEducations() != null) { 56 | for (Education education : addedCv.getEducations()) { 57 | education.setCv(addedCv); 58 | education.setCvId(addedCv.getId()); 59 | this.educationService.add(education); 60 | } 61 | } 62 | 63 | if (addedCv.getExperiences() != null) { 64 | for (Experience experience : addedCv.getExperiences()) { 65 | experience.setCv(addedCv); 66 | experience.setCvId(addedCv.getId()); 67 | this.experienceService.add(experience); 68 | } 69 | } 70 | 71 | if (addedCv.getLanguages() != null) { 72 | for (CvLanguage cvLanguage : addedCv.getLanguages()) { 73 | cvLanguage.setCv(addedCv); 74 | cvLanguage.setCvId(addedCv.getId()); 75 | this.cvLanguageService.add(cvLanguage); 76 | } 77 | } 78 | 79 | if (addedCv.getSkills() != null) { 80 | for (Skill skill : addedCv.getSkills()) { 81 | skill.setCv(cv); 82 | skill.setCvId(addedCv.getId()); 83 | this.skillService.add(skill); 84 | } 85 | } 86 | 87 | if (addedCv.getPhotos() != null) { 88 | for (Photo photo : addedCv.getPhotos()) { 89 | photo.setCv(cv); 90 | photo.setCvId(addedCv.getId()); 91 | this.photoService.add(photo); 92 | } 93 | } 94 | 95 | return new SuccessResult("Kayıt başarıllı"); 96 | } 97 | return new ErrorResult("Kayıt başarısız"); 98 | } 99 | 100 | @Override 101 | public DataResult> getAll() { 102 | return new SuccessDataResult>(this.cvDao.findAll()); 103 | } 104 | 105 | @Override 106 | public DataResult> getByCandidateId(int candidateId) { 107 | return new SuccessDataResult>(cvDao.getByUserId(candidateId)); 108 | } 109 | 110 | @Override 111 | public DataResult uploadCvPhoto(int cvId, MultipartFile photoFile) { 112 | return this.photoService.upload(photoFile, cvId); 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/EducationManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.EducationService; 9 | import kodlamaio.hrms.core.utilities.results.DataResult; 10 | import kodlamaio.hrms.core.utilities.results.Result; 11 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 12 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 13 | import kodlamaio.hrms.dataAccess.abstracts.EducationDao; 14 | import kodlamaio.hrms.entities.concretes.Education; 15 | 16 | @Service 17 | public class EducationManager implements EducationService { 18 | 19 | private EducationDao educationDao; 20 | 21 | @Autowired 22 | public EducationManager(EducationDao educationDao) { 23 | super(); 24 | this.educationDao = educationDao; 25 | } 26 | 27 | @Override 28 | public Result add(Education education) { 29 | this.educationDao.save(education); 30 | return new SuccessResult(); 31 | } 32 | 33 | @Override 34 | public DataResult> getByCvIdWithOrdered(int cvId) { 35 | return new SuccessDataResult>(this.educationDao.getByCvIdWithOrdered(cvId)); 36 | } 37 | 38 | @Override 39 | public DataResult> getByCandidateIdWithOrdered(int candidateId) { 40 | return new SuccessDataResult>(this.educationDao.getByCandidateIdWithOrdered(candidateId)); 41 | } 42 | 43 | @Override 44 | public DataResult getById(int educationId) { 45 | return new SuccessDataResult(this.educationDao.getById(educationId)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/EmailActivationManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | import kodlamaio.hrms.business.abstracts.ActivationService; 6 | import kodlamaio.hrms.core.utilities.results.Result; 7 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 8 | 9 | @Service 10 | public class EmailActivationManager implements ActivationService { 11 | 12 | @Override 13 | public Result sendActivationCode(String email, String activationCode) { 14 | // TODO Email adresine aktivasyon kodunun gönderilmesi 15 | /* 16 | * CreateActivation link: link güvenlik için hashlenmeli ve 17 | * parse edildiğinde data kısmından email ve 18 | * aktivasyon kodu alınabilmeli 19 | */ 20 | 21 | String activationLink = "(AuthContrellerLink)/activate?email=" + email + "&activationcode=" + activationCode; 22 | 23 | System.out.println("Your activation code: " + activationCode ); 24 | System.out.println("Please click the activation link to activate your account: " + activationLink ); 25 | return new SuccessResult(); 26 | } 27 | 28 | 29 | } -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/EmployeeManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.EmployeeService; 9 | import kodlamaio.hrms.business.constants.Messages; 10 | import kodlamaio.hrms.core.utilities.results.DataResult; 11 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 12 | import kodlamaio.hrms.core.utilities.results.Result; 13 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 14 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 15 | import kodlamaio.hrms.dataAccess.abstracts.EmployeeDao; 16 | import kodlamaio.hrms.entities.concretes.Employee; 17 | 18 | @Service 19 | public class EmployeeManager implements EmployeeService { 20 | 21 | private EmployeeDao employeeDao; 22 | 23 | @Autowired 24 | public EmployeeManager(EmployeeDao employeeDao) { 25 | this.employeeDao = employeeDao; 26 | } 27 | 28 | @Override 29 | public DataResult> getAll() { 30 | return new SuccessDataResult> 31 | (this.employeeDao.findAll()); 32 | } 33 | 34 | @Override 35 | public Result add(Employee employe) { 36 | var result = employeeDao.save(employe); 37 | if(result != null) { 38 | return new SuccessResult(Messages.userAddedSuccess); 39 | } 40 | return new ErrorResult(); 41 | } 42 | 43 | @Override 44 | public Result checkLogin(String email, String password) { 45 | Employee employee = this.employeeDao.findEmployeeByEmailAndPassword(email, password); 46 | if(employee != null) { 47 | if(employee.isActive() && !employee.isDeleted()) { 48 | return new SuccessResult(); 49 | } 50 | } 51 | return new ErrorResult(); 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/EmployerManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.EmployerService; 9 | import kodlamaio.hrms.business.abstracts.UserValidationService; 10 | import kodlamaio.hrms.business.constants.Messages; 11 | import kodlamaio.hrms.core.utilities.results.DataResult; 12 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 13 | import kodlamaio.hrms.core.utilities.results.Result; 14 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 15 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 16 | import kodlamaio.hrms.dataAccess.abstracts.EmployerDao; 17 | import kodlamaio.hrms.entities.concretes.Employer; 18 | 19 | @Service 20 | public class EmployerManager implements EmployerService { 21 | 22 | private EmployerDao employerDao; 23 | private UserValidationService validationService; 24 | 25 | @Autowired 26 | public EmployerManager(EmployerDao employerDao, UserValidationService validationService) { 27 | super(); 28 | this.employerDao = employerDao; 29 | this.validationService = validationService; 30 | } 31 | 32 | @Override 33 | public DataResult> getAll() { 34 | return new SuccessDataResult> 35 | (this.employerDao.findAll(),"Employers listed"); 36 | } 37 | 38 | @Override 39 | public Result add(Employer employer) { 40 | var result = this.employerDao.save(employer); 41 | if(result != null) { 42 | return new SuccessResult(Messages.userAddedSuccess); 43 | } 44 | return new ErrorResult(); 45 | } 46 | 47 | @Override 48 | public Result checkLogin(String email, String password) { 49 | Employer employer = this.employerDao.findEmployerByEmailAndPassword(email, password); 50 | if(employer != null) { 51 | if(employer.isActive() && employer.isAdminConfirm() && !employer.isDeleted()) { 52 | return new SuccessResult(); 53 | } 54 | } 55 | return new ErrorResult(); 56 | } 57 | 58 | @Override 59 | public Result validate(Employer employer) { 60 | var errors = validationService.validate(employer); 61 | 62 | if(errors != null) { 63 | String message = ""; 64 | for (String error : errors.getData()) { 65 | message += error + "\n"; 66 | } 67 | return new ErrorResult(message); 68 | } 69 | return new SuccessResult(); 70 | } 71 | 72 | @Override 73 | public Result verifyByAdmin(Employer employer) { 74 | employer.setAdminConfirm(true); 75 | var result = employerDao.save(employer); 76 | if(result != null) { 77 | return new SuccessResult(Messages.employerVerifiedByAdmin); 78 | } 79 | return new ErrorResult(); 80 | } 81 | 82 | @Override 83 | public boolean isActive(int employerId) { 84 | Employer employer = this.employerDao.getById(employerId); 85 | return employer.isActive() && employer.isAdminConfirm() && !employer.isDeleted(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/EmployerValidationManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | import org.springframework.stereotype.Service; 9 | 10 | import kodlamaio.hrms.business.constants.Messages; 11 | import kodlamaio.hrms.core.utilities.results.DataResult; 12 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 13 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 14 | import kodlamaio.hrms.core.utilities.results.Result; 15 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 16 | import kodlamaio.hrms.entities.concretes.Employer; 17 | import kodlamaio.hrms.business.abstracts.UserValidationService; 18 | 19 | @Service 20 | public class EmployerValidationManager implements UserValidationService { 21 | private List errors = new ArrayList(); 22 | 23 | @Override 24 | public DataResult> validate(Employer employer) { 25 | errors.clear(); 26 | var isEmailNotNull = checkIsNotNull("Email", employer.getEmail()).isSuccess(); 27 | if(isEmailNotNull) { 28 | checkEmailPattern(employer.getEmail()); 29 | } 30 | checkIsNotNull("Company Name", employer.getCompanyName()); 31 | checkIsNotNull("Phone Number", employer.getPhoneNumber()); 32 | var isWebsiteNotNull = checkIsNotNull("Website", employer.getWebsite()).isSuccess(); 33 | 34 | if(isWebsiteNotNull && isEmailNotNull) { 35 | checkEmailDomain(employer.getEmail(), employer.getWebsite()); 36 | } 37 | 38 | if(!this.errors.isEmpty()) { 39 | return new ErrorDataResult>(errors); 40 | } 41 | return null; 42 | } 43 | 44 | private Result checkIsNotNull(String fieldName, String value) { 45 | if (value == null || value.isBlank()) { 46 | errors.add(fieldName + Messages.canNotNull); 47 | return new ErrorResult(); 48 | } 49 | return new SuccessResult(); 50 | } 51 | 52 | private Result checkEmailPattern(String email) { 53 | 54 | Pattern pattern = Pattern.compile( 55 | "^[a-zA-Z0-9_!#$%&’*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$"); 56 | boolean result = pattern.matcher(email).matches(); 57 | if (!result) { 58 | errors.add(Messages.invalidEmail); 59 | return new ErrorResult(); 60 | } 61 | return new SuccessResult(); 62 | } 63 | 64 | private Result checkEmailDomain(String email, String website) { 65 | Pattern regex = Pattern.compile("(?<=@)\\S+"); 66 | Matcher regexMatcher = regex.matcher(email); 67 | if (regexMatcher.find()) { 68 | String resultString = regexMatcher.group(); 69 | 70 | if (resultString.equals(website)) { 71 | System.out.println(resultString); 72 | return new SuccessResult(); 73 | } 74 | } 75 | errors.add(Messages.notMatchEmailAndDomain); 76 | return new ErrorResult(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/ExperienceManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.ExperienceService; 9 | import kodlamaio.hrms.core.utilities.results.DataResult; 10 | import kodlamaio.hrms.core.utilities.results.Result; 11 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 12 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 13 | import kodlamaio.hrms.dataAccess.abstracts.ExperienceDao; 14 | import kodlamaio.hrms.entities.concretes.Experience; 15 | 16 | @Service 17 | public class ExperienceManager implements ExperienceService { 18 | 19 | private ExperienceDao experienceDao; 20 | 21 | @Autowired 22 | public ExperienceManager(ExperienceDao experienceDao) { 23 | super(); 24 | this.experienceDao = experienceDao; 25 | } 26 | 27 | @Override 28 | public Result add(Experience experience) { 29 | this.experienceDao.save(experience); 30 | return new SuccessResult(); 31 | } 32 | 33 | @Override 34 | public DataResult> getByCvIdWithOrdered(int cvId) { 35 | return new SuccessDataResult>(this.experienceDao.getByCvIdWithOrdered(cvId)); 36 | } 37 | 38 | @Override 39 | public DataResult> getByCandidateIdWithOrdered(int candidateId) { 40 | return new SuccessDataResult>(this.experienceDao.getByCandidateIdWithOrdered(candidateId)); 41 | } 42 | 43 | @Override 44 | public DataResult getById(int experienceId) { 45 | return new SuccessDataResult(this.experienceDao.getById(experienceId)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/JobAdvertisementManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.time.LocalDate; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.data.domain.Sort; 8 | import org.springframework.stereotype.Service; 9 | 10 | import kodlamaio.hrms.business.abstracts.EmployerService; 11 | import kodlamaio.hrms.business.abstracts.JobAdvertisementService; 12 | import kodlamaio.hrms.business.constants.Messages; 13 | import kodlamaio.hrms.core.utilities.results.DataResult; 14 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 15 | import kodlamaio.hrms.core.utilities.results.Result; 16 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 17 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 18 | import kodlamaio.hrms.dataAccess.abstracts.JobAdvertisementDao; 19 | import kodlamaio.hrms.entities.concretes.JobAdvertisement; 20 | import kodlamaio.hrms.entities.dtos.JobAdvertisementDto; 21 | 22 | @Service 23 | public class JobAdvertisementManager implements JobAdvertisementService { 24 | 25 | private JobAdvertisementDao jobAdvertisementDao; 26 | private EmployerService employerService; 27 | 28 | @Autowired 29 | public JobAdvertisementManager(JobAdvertisementDao jobAdvertisementDao, EmployerService employerService) { 30 | super(); 31 | this.jobAdvertisementDao = jobAdvertisementDao; 32 | this.employerService = employerService; 33 | } 34 | 35 | @Override 36 | public Result add(JobAdvertisement jobAdvertisement) { 37 | if(employerService.isActive(jobAdvertisement.getEmployer().getId())) { 38 | var result = this.jobAdvertisementDao.save(jobAdvertisement); 39 | if(result != null) { 40 | return new SuccessResult(Messages.advertiseAddedSuccessfully); 41 | } 42 | return new ErrorResult(); 43 | } 44 | return new ErrorResult(Messages.employerNotActive); 45 | } 46 | 47 | @Override 48 | public DataResult> getAll() { 49 | return new SuccessDataResult> 50 | (this.jobAdvertisementDao.findAll(),Messages.listedData); 51 | } 52 | 53 | @Override 54 | public DataResult> getActiveAdvertisements() { 55 | 56 | return new SuccessDataResult>(this.jobAdvertisementDao.getActiveAdvertisements(), Messages.listedData); 57 | } 58 | 59 | @Override 60 | public DataResult> getActiveAdvertisementsByCreatedDate(LocalDate date) { 61 | return new SuccessDataResult>(this.jobAdvertisementDao.getActiveAdvertisementsByCreatedDate(date), Messages.listedData); 62 | } 63 | 64 | @Override 65 | public DataResult> getActiveAdvertisementsByExpirationDate(LocalDate date) { 66 | return new SuccessDataResult>(this.jobAdvertisementDao.getActiveAdvertisementsByExpirationDate(date), Messages.listedData); 67 | } 68 | 69 | @Override 70 | public DataResult> getActiveAdvertisementsByEmployerId(int employerId) { 71 | return new SuccessDataResult>(this.jobAdvertisementDao.getActiveAdvertisementsByEmployerId(employerId), Messages.listedData); 72 | } 73 | 74 | @Override 75 | public DataResult> getActiveAdvertisementsSortBy(String fieldName, boolean isDesc) { 76 | var direction = (isDesc)? Sort.Direction.DESC : Sort.Direction.ASC; 77 | Sort sort = Sort.by(direction,fieldName); 78 | return new SuccessDataResult> 79 | (this.jobAdvertisementDao.getActiveAdvertisements(sort)); 80 | } 81 | 82 | @Override 83 | public Result setAdvertisementStatus(int advertisementId, boolean status) { 84 | JobAdvertisement jobAdvertisement = this.jobAdvertisementDao.getByAdvertisementId(advertisementId); 85 | jobAdvertisement.setActive(status); 86 | var result = this.jobAdvertisementDao.save(jobAdvertisement); 87 | if(result != null) { 88 | return new SuccessResult(); 89 | } 90 | return new ErrorResult(); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/JobPostionManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.JobPositionService; 9 | import kodlamaio.hrms.core.utilities.results.DataResult; 10 | import kodlamaio.hrms.core.utilities.results.Result; 11 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 12 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 13 | import kodlamaio.hrms.dataAccess.abstracts.JobPositionDao; 14 | import kodlamaio.hrms.entities.concretes.JobPosition; 15 | 16 | @Service 17 | public class JobPostionManager implements JobPositionService { 18 | 19 | private JobPositionDao jobPositionDao; 20 | 21 | @Autowired 22 | public JobPostionManager(JobPositionDao jobPositionDao) { 23 | super(); 24 | this.jobPositionDao = jobPositionDao; 25 | } 26 | 27 | @Override 28 | public DataResult> getAll() { 29 | return new SuccessDataResult>(this.jobPositionDao.findAll()); 30 | } 31 | 32 | @Override 33 | public Result add(JobPosition jobPosition) { 34 | this.jobPositionDao.save(jobPosition); 35 | return new SuccessResult("Added new job position successfully"); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/PhotoManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.time.LocalDate; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.web.multipart.MultipartFile; 10 | 11 | import kodlamaio.hrms.business.abstracts.PhotoService; 12 | import kodlamaio.hrms.core.utilities.helpers.PhotoUploadHelper; 13 | import kodlamaio.hrms.core.utilities.results.DataResult; 14 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 15 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 16 | import kodlamaio.hrms.core.utilities.results.Result; 17 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 18 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 19 | import kodlamaio.hrms.dataAccess.abstracts.PhotoDao; 20 | import kodlamaio.hrms.entities.concretes.Photo; 21 | 22 | @Service 23 | public class PhotoManager implements PhotoService { 24 | 25 | PhotoUploadHelper photoUploadHelper; 26 | PhotoDao photoDao; 27 | 28 | @Autowired 29 | public PhotoManager(PhotoDao photoDao, PhotoUploadHelper photoUploadHelper) { 30 | super(); 31 | this.photoDao = photoDao; 32 | this.photoUploadHelper = photoUploadHelper; 33 | } 34 | 35 | @Override 36 | public Result add(Photo photo) { 37 | if(this.photoDao.save(photo) != null) { 38 | return new SuccessResult(); 39 | } 40 | return new ErrorResult(); 41 | } 42 | 43 | @Override 44 | public DataResult> getByCvId(int cvId) { 45 | var result = this.photoDao.getByCvId(cvId); 46 | if(result != null) { 47 | return new SuccessDataResult>(result); 48 | } 49 | return new ErrorDataResult>(); 50 | } 51 | 52 | @Override 53 | public DataResult upload(MultipartFile photoFile, int cvId) { 54 | DataResult> result = this.photoUploadHelper.upload(photoFile); 55 | 56 | if(result.isSuccess()) { 57 | 58 | Photo photo = new Photo(); 59 | photo.setCvId(cvId); 60 | photo.setCreatedDate(LocalDate.now()); 61 | photo.setImage(result.getData().get("url")); 62 | photo.setTitle(result.getData().get("public_id")); 63 | Result addingResult = this.add(photo); 64 | if (addingResult.isSuccess()) { 65 | return new SuccessDataResult(photo); 66 | } 67 | } 68 | return new ErrorDataResult(null,"Dosya yüklenemedi"); 69 | } 70 | 71 | @Override 72 | public DataResult> getByCandidateId(int candidateId) { 73 | var result = this.photoDao.getByCandidateId(candidateId); 74 | if(result != null) { 75 | return new SuccessDataResult>(result); 76 | } 77 | return new ErrorDataResult>(); 78 | } 79 | 80 | @Override 81 | public DataResult getById(int photoId) { 82 | var result = this.photoDao.getById(photoId); 83 | if(result != null) { 84 | return new SuccessDataResult(result); 85 | } 86 | return new ErrorDataResult(); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/SkillManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.SkillService; 9 | import kodlamaio.hrms.core.utilities.results.DataResult; 10 | import kodlamaio.hrms.core.utilities.results.Result; 11 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 12 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 13 | import kodlamaio.hrms.dataAccess.abstracts.SkillDao; 14 | import kodlamaio.hrms.entities.concretes.Skill; 15 | 16 | @Service 17 | public class SkillManager implements SkillService { 18 | 19 | private SkillDao skillDao; 20 | 21 | @Autowired 22 | public SkillManager(SkillDao skillDao) { 23 | super(); 24 | this.skillDao = skillDao; 25 | } 26 | 27 | @Override 28 | public Result add(Skill skill) { 29 | this.skillDao.save(skill); 30 | return new SuccessResult(); 31 | } 32 | 33 | @Override 34 | public DataResult> getByCvId(int cvId) { 35 | return new SuccessDataResult>(this.skillDao.getByCvId(cvId)); 36 | } 37 | 38 | @Override 39 | public DataResult getById(int skillId) { 40 | return new SuccessDataResult(this.skillDao.getById(skillId)); 41 | } 42 | 43 | @Override 44 | public DataResult> getByCandidateId(int candidateId) { 45 | return new SuccessDataResult>(this.skillDao.getByCandidateId(candidateId)); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/concretes/UserManager.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.concretes; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import kodlamaio.hrms.business.abstracts.UserService; 9 | import kodlamaio.hrms.core.utilities.results.DataResult; 10 | import kodlamaio.hrms.core.utilities.results.ErrorDataResult; 11 | import kodlamaio.hrms.core.utilities.results.ErrorResult; 12 | import kodlamaio.hrms.core.utilities.results.Result; 13 | import kodlamaio.hrms.core.utilities.results.SuccessDataResult; 14 | import kodlamaio.hrms.core.utilities.results.SuccessResult; 15 | import kodlamaio.hrms.dataAccess.abstracts.UserDao; 16 | import kodlamaio.hrms.entities.concretes.User; 17 | import kodlamaio.hrms.business.constants.Messages; 18 | 19 | @Service 20 | public class UserManager implements UserService { 21 | 22 | private UserDao userDao; 23 | 24 | @Autowired 25 | public UserManager(UserDao userDao) { 26 | super(); 27 | this.userDao = userDao; 28 | } 29 | 30 | @Override 31 | public DataResult> getAll() { 32 | return new SuccessDataResult> 33 | (this.userDao.findAll(),"Users listed"); 34 | } 35 | 36 | @Override 37 | public DataResult getByEmail(String email) { 38 | 39 | User user = this.userDao.findUserByEmail(email); 40 | if(user == null) { 41 | return new ErrorDataResult(); 42 | } 43 | return new SuccessDataResult(user); 44 | } 45 | 46 | @Override 47 | public Result add(User user) { 48 | this.userDao.save(user); 49 | return new SuccessResult("User added successfully"); 50 | } 51 | 52 | @Override 53 | public Result confirmActivation(String email, String activationCode) { 54 | User user = this.userDao.findUserByEmail(email); 55 | if(user != null) { 56 | if(!user.isActive()) { 57 | if(user.getActivationCode().equals(activationCode) && !user.isDeleted()) { 58 | user.setActive(true); 59 | userDao.save(user); 60 | return new SuccessResult(Messages.confirmActivationSuccess); 61 | } 62 | } 63 | return new SuccessResult(Messages.allreadyConfirm); 64 | } 65 | return new ErrorResult(); 66 | } 67 | 68 | @Override 69 | public Result checkLogin(String email, String password) { 70 | User user = this.userDao.findUserByEmailAndPassword(email, password); 71 | if(user != null) { 72 | if(user.isActive() && !user.isDeleted()) { 73 | return new SuccessResult(); 74 | } 75 | } 76 | return new ErrorResult(); 77 | } 78 | 79 | @Override 80 | public boolean checkIfExistsUserByEmail(String email) { 81 | return this.userDao.existsByEmail(email); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/business/constants/Messages.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.business.constants; 2 | 3 | public final class Messages { 4 | public static String invalidEmail = "Email adress is invalid"; 5 | public static String canNotNull = " is cannot be empty!"; 6 | public static String userAddedSuccess = "User added successfully"; 7 | public static String invalidTCKNo = "TCK No is invalid"; 8 | public static String invalidYearOfBirth = "Year of birth is invalid"; 9 | public static String passwordsNotMatch = "Passwords do not match"; 10 | public static String userExists = "This user allready exists"; 11 | public static String NotRealPerson = "User is not real person"; 12 | public static String saveUserAndSendCode = "User added successfully and activation link has been sent to registration email address"; 13 | public static String saveUserButNotSendCode = "User added successfully but the activation code could not be sent"; 14 | public static String notMatchEmailAndDomain = "Mail and domain name do not match"; 15 | public static String confirmActivationSuccess = "Confirm activation successfully"; 16 | public static String allreadyConfirm = "Activation has already been completed."; 17 | public static String employerVerifiedByAdmin = "Employer verified."; 18 | public static String cityAddedSuccess = "City added successfuly"; 19 | public static String listedData = "Data listed"; 20 | public static String advertiseAddedSuccessfully = "Job advertise added successfuly"; 21 | public static String employerNotActive = "Employer isn't active."; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/BeanDeserializerModifierForIgnorables.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.databind.BeanDescription; 7 | import com.fasterxml.jackson.databind.DeserializationConfig; 8 | import com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder; 9 | import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier; 10 | import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; 11 | 12 | public class BeanDeserializerModifierForIgnorables extends BeanDeserializerModifier { 13 | 14 | private java.lang.Class type; 15 | private List ignorables; 16 | 17 | public BeanDeserializerModifierForIgnorables(java.lang.Class clazz, String... properties) { 18 | ignorables = new ArrayList<>(); 19 | for(String property : properties) { 20 | ignorables.add(property); 21 | } 22 | this.type = clazz; 23 | } 24 | 25 | @Override 26 | public BeanDeserializerBuilder updateBuilder( 27 | DeserializationConfig config, BeanDescription beanDesc, 28 | BeanDeserializerBuilder builder) { 29 | if(!type.equals(beanDesc.getBeanClass())) { 30 | return builder; 31 | } 32 | 33 | for(String ignorable : ignorables) { 34 | builder.addIgnorable(ignorable); 35 | } 36 | 37 | return builder; 38 | } 39 | 40 | @Override 41 | public List updateProperties( 42 | DeserializationConfig config, BeanDescription beanDesc, 43 | List propDefs) { 44 | if(!type.equals(beanDesc.getBeanClass())) { 45 | return propDefs; 46 | } 47 | 48 | List newPropDefs = new ArrayList<>(); 49 | for(BeanPropertyDefinition propDef : propDefs) { 50 | if(!ignorables.contains(propDef.getName())) { 51 | newPropDefs.add(propDef); 52 | } 53 | } 54 | return newPropDefs; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/helpers/PhotoUploadHelper.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities.helpers; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import kodlamaio.hrms.core.utilities.results.DataResult; 9 | 10 | public interface PhotoUploadHelper { 11 | DataResult> upload(MultipartFile file); 12 | DataResult delete(String id) throws IOException; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/results/DataResult.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities.results; 2 | 3 | public class DataResult extends Result { 4 | 5 | private T data; 6 | public DataResult(T data, boolean success, String message) { 7 | super(success, message); 8 | this.data = data; 9 | } 10 | public DataResult(T data, boolean success) { 11 | super(success); 12 | this.data = data; 13 | } 14 | 15 | public T getData() { 16 | return data; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/results/ErrorDataResult.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities.results; 2 | 3 | public class ErrorDataResult extends DataResult { 4 | 5 | public ErrorDataResult(T data) { 6 | super(data, false); 7 | } 8 | 9 | public ErrorDataResult(T data, String message) { 10 | super(data, false, message); 11 | } 12 | 13 | public ErrorDataResult(String message) { 14 | super(null, false, message); 15 | } 16 | 17 | public ErrorDataResult() { 18 | super(null, false); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/results/ErrorResult.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities.results; 2 | 3 | public class ErrorResult extends Result { 4 | 5 | public ErrorResult() { 6 | super(false); 7 | } 8 | 9 | public ErrorResult(String message) { 10 | super(false, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/results/Result.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities.results; 2 | 3 | public class Result { 4 | 5 | private boolean success; 6 | private String message; 7 | 8 | public Result(boolean success) { 9 | this.success = success; 10 | } 11 | 12 | public Result(boolean success, String message) { 13 | this(success); 14 | this.message = message; 15 | } 16 | 17 | public boolean isSuccess() { 18 | return this.success; 19 | } 20 | 21 | public String getMessage() { 22 | return this.message; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/results/SuccessDataResult.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities.results; 2 | 3 | public class SuccessDataResult extends DataResult { 4 | 5 | public SuccessDataResult(T data) { 6 | super(data, true); 7 | } 8 | 9 | public SuccessDataResult(T data, String message) { 10 | super(data, true, message); 11 | } 12 | 13 | public SuccessDataResult(String message) { 14 | super(null, true, message); 15 | } 16 | 17 | public SuccessDataResult() { 18 | super(null, true); 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/core/utilities/results/SuccessResult.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.core.utilities.results; 2 | 3 | public class SuccessResult extends Result { 4 | 5 | public SuccessResult() { 6 | super(true); 7 | } 8 | 9 | public SuccessResult(String message) { 10 | super(true, message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/CandidateDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import kodlamaio.hrms.entities.concretes.Candidate; 6 | 7 | public interface CandidateDao extends JpaRepository{ 8 | 9 | Candidate findCandidateByEmailAndPassword(String email, String password); 10 | boolean existsByNationalityId(String nationalityId); 11 | } -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/CityDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import kodlamaio.hrms.entities.concretes.City; 6 | 7 | public interface CityDao extends JpaRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/CvDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | import kodlamaio.hrms.entities.concretes.Cv; 8 | 9 | public interface CvDao extends JpaRepository { 10 | 11 | List getByUserId(int candidateId); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/CvLanguageDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import kodlamaio.hrms.entities.concretes.CvLanguage; 9 | 10 | public interface CvLanguageDao extends JpaRepository { 11 | 12 | List getByCvId(int cvId); 13 | CvLanguage getById(int languageId); 14 | @Query(value = "SELECT l.language_id, l.cv_id, l.language_name, l.language_level" 15 | + " From cv_languages l left join cvs cv on l.cv_id = cv.cv_id" 16 | + " where cv.user_id=:candidateId Order By l.language_name", nativeQuery = true) 17 | List getByCandidateId(int candidateId); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/EducationDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import kodlamaio.hrms.entities.concretes.Education; 9 | 10 | public interface EducationDao extends JpaRepository { 11 | 12 | @Query("From Education where cvId=:cvId Order By graduationDate DESC Nulls First") 13 | List getByCvIdWithOrdered(int cvId); 14 | 15 | @Query(value = "SELECT e.education_id, e.cv_id, e.school_name, e.program_name, e.start_date, e.graduation_date" 16 | + " From educations e left join cvs cv on e.cv_id = cv.cv_id" 17 | + " where cv.user_id=:candidateId Order By e.graduation_date DESC Nulls First", nativeQuery = true) 18 | List getByCandidateIdWithOrdered(int candidateId); 19 | 20 | Education getById(int educationId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/EmployeeDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import kodlamaio.hrms.entities.concretes.Employee; 6 | 7 | public interface EmployeeDao extends JpaRepository { 8 | 9 | Employee findEmployeeByEmailAndPassword(String email, String password); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/EmployerDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import kodlamaio.hrms.entities.concretes.Employer; 6 | 7 | public interface EmployerDao extends JpaRepository { 8 | 9 | Employer findEmployerByEmailAndPassword(String email, String password); 10 | Employer getById(int employerId); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/ExperienceDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import kodlamaio.hrms.entities.concretes.Experience; 9 | 10 | public interface ExperienceDao extends JpaRepository { 11 | 12 | @Query("From Experience where cvId=:cvId Order By departureDate DESC Nulls First") 13 | List getByCvIdWithOrdered(int cvId); 14 | 15 | @Query(value = "SELECT e.experience_id, e.cv_id, e.workplace_name, e.job_title, e.start_date, e.departure_date" 16 | + " From experiences e left join cvs cv on e.cv_id = cv.cv_id" 17 | + " where cv.user_id=:candidateId Order By e.departure_date DESC Nulls First", nativeQuery = true) 18 | List getByCandidateIdWithOrdered(int candidateId); 19 | 20 | Experience getById(int experienceId); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/JobAdvertisementDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import java.time.LocalDate; 4 | import java.util.List; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.data.domain.Sort; 9 | 10 | import kodlamaio.hrms.entities.concretes.JobAdvertisement; 11 | import kodlamaio.hrms.entities.dtos.JobAdvertisementDto; 12 | 13 | public interface JobAdvertisementDao extends JpaRepository { 14 | 15 | JobAdvertisement getByAdvertisementId(int advertisementId); 16 | 17 | @Query(value = "SELECT new kodlamaio.hrms.entities.dtos.JobAdvertisementDto(ja.advertisementId as advertisementId, ja.employer.companyName as companyName, ja.jobPosition.positionName as positionName," 18 | + " ja.numberOfOpenPositions as numberOfOpenPositions, ja.createdDate as createdDate, ja.expirationDate as expirationDate) FROM JobAdvertisement ja" 19 | + " WHERE ja.active = true") 20 | List getActiveAdvertisements(); 21 | 22 | @Query(value = "SELECT new kodlamaio.hrms.entities.dtos.JobAdvertisementDto(ja.advertisementId as advertisementId, ja.employer.companyName as companyName, ja.jobPosition.positionName as positionName," 23 | + " ja.numberOfOpenPositions as numberOfOpenPositions, ja.createdDate as createdDate, ja.expirationDate as expirationDate) FROM JobAdvertisement ja" 24 | + " WHERE ja.active = true") 25 | List getActiveAdvertisements(Sort sort); 26 | 27 | @Query(value = "SELECT new kodlamaio.hrms.entities.dtos.JobAdvertisementDto(ja.advertisementId as advertisementId, ja.employer.companyName as companyName, ja.jobPosition.positionName as positionName," 28 | + " ja.numberOfOpenPositions as numberOfOpenPositions, ja.createdDate as createdDate, ja.expirationDate as expirationDate) FROM JobAdvertisement ja" 29 | + " WHERE ja.active = true and ja.createdDate =:date") 30 | List getActiveAdvertisementsByCreatedDate(LocalDate date); 31 | 32 | @Query(value = "SELECT new kodlamaio.hrms.entities.dtos.JobAdvertisementDto(ja.advertisementId as advertisementId, ja.employer.companyName as companyName, ja.jobPosition.positionName as positionName," 33 | + " ja.numberOfOpenPositions as numberOfOpenPositions, ja.createdDate as createdDate, ja.expirationDate as expirationDate) FROM JobAdvertisement ja" 34 | + " WHERE ja.active = true and ja.expirationDate =:date") 35 | List getActiveAdvertisementsByExpirationDate(LocalDate date); 36 | 37 | @Query(value = "SELECT new kodlamaio.hrms.entities.dtos.JobAdvertisementDto(ja.advertisementId as advertisementId, ja.employer.companyName as companyName, ja.jobPosition.positionName as positionName," 38 | + " ja.numberOfOpenPositions as numberOfOpenPositions, ja.createdDate as createdDate, ja.expirationDate as expirationDate) FROM JobAdvertisement ja" 39 | + " WHERE ja.active = true and ja.employer.id =:employerId") 40 | List getActiveAdvertisementsByEmployerId(int employerId); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/JobPositionDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import kodlamaio.hrms.entities.concretes.JobPosition; 6 | 7 | public interface JobPositionDao extends JpaRepository { 8 | boolean existsByPositionName(String positionName); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/PhotoDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import kodlamaio.hrms.entities.concretes.Photo; 9 | 10 | public interface PhotoDao extends JpaRepository { 11 | 12 | List getByCvId(int cvId); 13 | Photo getById(int photoId); 14 | @Query(value = "SELECT p.photo_id, p.cv_id, p.image, p.title" 15 | + " From photos p left join cvs cv on p.cv_id = cv.cv_id" 16 | + " where cv.user_id=:candidateId", nativeQuery = true) 17 | List getByCandidateId(int candidateId); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/SkillDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | 8 | import kodlamaio.hrms.entities.concretes.Skill; 9 | 10 | public interface SkillDao extends JpaRepository { 11 | 12 | List getByCvId(int cvId); 13 | Skill getById(int skillId); 14 | @Query(value = "SELECT s.skill_id, s.cv_id, s.skill, s.skill_level" 15 | + " From cv_languages s left join cvs cv on s.cv_id = cv.cv_id" 16 | + " where cv.user_id=:candidateId Order By s.skill_name", nativeQuery = true) 17 | List getByCandidateId(int candidateId); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/dataAccess/abstracts/UserDao.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.dataAccess.abstracts; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | import kodlamaio.hrms.entities.concretes.User; 6 | 7 | public interface UserDao extends JpaRepository { 8 | User findUserByEmail(String email); 9 | User findUserByEmailAndPassword(String email, String password); 10 | boolean existsByEmail(String email); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/abstracts/ValidatableUser.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.abstracts; 2 | 3 | public interface ValidatableUser { 4 | String getFirstName(); 5 | String getLastName(); 6 | String getNationalityId(); 7 | Integer getYearOfBirth(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Candidate.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.util.List; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.OneToMany; 8 | import javax.persistence.OneToOne; 9 | import javax.persistence.PrimaryKeyJoinColumn; 10 | import javax.persistence.Table; 11 | 12 | import com.fasterxml.jackson.annotation.JsonIgnore; 13 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 14 | 15 | import lombok.AllArgsConstructor; 16 | import lombok.Data; 17 | import lombok.EqualsAndHashCode; 18 | import lombok.NoArgsConstructor; 19 | 20 | @Data 21 | @EqualsAndHashCode(callSuper=false) 22 | @Entity 23 | @Table(name = "candidates") 24 | @PrimaryKeyJoinColumn(name = "user_id") 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","cv"}) 28 | public class Candidate extends User{ 29 | 30 | @Column(name= "first_name") 31 | private String firstName; 32 | 33 | @Column(name= "last_name") 34 | private String lastName; 35 | 36 | @Column(name= "nationality_id") 37 | private String nationalityId; 38 | 39 | @Column(name= "year_of_birth") 40 | private int yearOfBirth; 41 | 42 | @JsonIgnore 43 | @OneToMany(mappedBy = "candidate") 44 | private List cv; 45 | 46 | public Candidate( 47 | String firstName, 48 | String lastName, 49 | String nationalityId, 50 | int yearOfBirth, 51 | String email, 52 | String password) { 53 | 54 | super(email,password,null); 55 | this.firstName = firstName; 56 | this.lastName = lastName; 57 | this.nationalityId = nationalityId; 58 | this.yearOfBirth = yearOfBirth; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/City.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.util.List; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.GenerationType; 9 | import javax.persistence.Id; 10 | import javax.persistence.OneToMany; 11 | import javax.persistence.Table; 12 | 13 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 14 | 15 | import lombok.AllArgsConstructor; 16 | import lombok.Data; 17 | import lombok.NoArgsConstructor; 18 | 19 | @Data 20 | @AllArgsConstructor 21 | @NoArgsConstructor 22 | @Table(name="cities") 23 | //@Inheritance(strategy = InheritanceType.JOINED) 24 | @Entity 25 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","jobAdvertisements"}) 26 | public class City { 27 | @Id 28 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 29 | @Column(name="city_id") 30 | private int cityId; 31 | 32 | @Column(name="city_name", nullable=false) 33 | private String cityName; 34 | 35 | @OneToMany(mappedBy = "city") 36 | private List jobAdvertisements; 37 | 38 | public City(String cityName) { 39 | super(); 40 | this.cityName = cityName; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Cv.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.util.List; 4 | 5 | import javax.persistence.CascadeType; 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.FetchType; 9 | import javax.persistence.GeneratedValue; 10 | import javax.persistence.GenerationType; 11 | import javax.persistence.Id; 12 | import javax.persistence.JoinColumn; 13 | import javax.persistence.ManyToOne; 14 | import javax.persistence.OneToMany; 15 | import javax.persistence.OneToOne; 16 | import javax.persistence.PrimaryKeyJoinColumn; 17 | import javax.persistence.Table; 18 | 19 | import com.fasterxml.jackson.annotation.JsonIgnore; 20 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 21 | 22 | import lombok.AllArgsConstructor; 23 | import lombok.Data; 24 | import lombok.NoArgsConstructor; 25 | 26 | @Data 27 | @Entity 28 | @Table(name="cvs") 29 | @AllArgsConstructor 30 | @NoArgsConstructor 31 | //@JsonIgnoreProperties({"hibernateLazyInitializer","handler", 32 | // "languages", "educations", "experiences", "skills", "photos"}) 33 | @PrimaryKeyJoinColumn(name="user_id",referencedColumnName = "user_id") 34 | public class Cv { 35 | 36 | @Id 37 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 38 | @Column(name="cv_id") 39 | private int id; 40 | 41 | @Column(name="github_link") 42 | private String githubLink; 43 | 44 | @Column(name="linkedin_link") 45 | private String linkedinLink; 46 | 47 | @Column(name="summary") 48 | private String summary; 49 | 50 | @JoinColumn(name = "user_id", insertable = false, updatable = false) 51 | @ManyToOne(targetEntity = Candidate.class, fetch = FetchType.EAGER) 52 | @JsonIgnore 53 | private Candidate candidate; 54 | 55 | @Column(name = "user_id") 56 | private int userId; 57 | 58 | 59 | @OneToMany(targetEntity=CvLanguage.class, mappedBy="cv",cascade=CascadeType.ALL, fetch = FetchType.LAZY) 60 | private List languages; 61 | 62 | @OneToMany(targetEntity=Education.class, mappedBy="cv",cascade=CascadeType.ALL, fetch = FetchType.LAZY) 63 | private List educations; 64 | 65 | @OneToMany(targetEntity=Experience.class, mappedBy="cv",cascade=CascadeType.ALL, fetch = FetchType.LAZY) 66 | private List experiences; 67 | 68 | @OneToMany(targetEntity=Skill.class, mappedBy="cv",cascade=CascadeType.ALL, fetch = FetchType.LAZY) 69 | private List skills; 70 | 71 | @OneToMany(targetEntity=Photo.class, mappedBy="cv",cascade=CascadeType.ALL, fetch = FetchType.LAZY) 72 | private List photos; 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/CvLanguage.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.FetchType; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.GenerationType; 8 | import javax.persistence.Id; 9 | import javax.persistence.JoinColumn; 10 | import javax.persistence.ManyToOne; 11 | import javax.persistence.PrimaryKeyJoinColumn; 12 | import javax.persistence.Table; 13 | 14 | import com.fasterxml.jackson.annotation.JsonIgnore; 15 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 16 | 17 | import lombok.AllArgsConstructor; 18 | import lombok.Data; 19 | import lombok.NoArgsConstructor; 20 | 21 | @Data 22 | @AllArgsConstructor 23 | @NoArgsConstructor 24 | @Table(name="cv_languages") 25 | @Entity 26 | @PrimaryKeyJoinColumn(name="cv_id",referencedColumnName = "cv_id") 27 | //@JsonIgnoreProperties(ignoreUnknown = true, 28 | //value = {"hibernateLazyInitializer","handler","cv"}) 29 | public class CvLanguage { 30 | 31 | @Id 32 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 33 | @Column(name="language_id") 34 | private int id; 35 | 36 | @Column(name="language_name", nullable=false) 37 | private String languageName; 38 | 39 | @Column(name="language_level", nullable=false) 40 | private int languageLevel; 41 | 42 | @JoinColumn(name = "cv_id", insertable = false, updatable = false) 43 | @ManyToOne(targetEntity = Cv.class, fetch = FetchType.EAGER) 44 | @JsonIgnore 45 | private Cv cv; 46 | 47 | @Column(name = "cv_id") 48 | private int cvId; 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Education.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.time.LocalDate; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.FetchType; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | import javax.persistence.JoinColumn; 12 | import javax.persistence.ManyToOne; 13 | import javax.persistence.PrimaryKeyJoinColumn; 14 | import javax.persistence.Table; 15 | 16 | import com.fasterxml.jackson.annotation.JsonIgnore; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | @Data 23 | @Entity 24 | @Table(name="educations") 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | //@JsonIgnoreProperties({"hibernateLazyInitializer","handler","cv"}) 28 | @PrimaryKeyJoinColumn(name="cv_id",referencedColumnName = "cv_id") 29 | public class Education { 30 | @Id 31 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 32 | @Column(name="education_id") 33 | private int id; 34 | 35 | @Column(name="school_name", nullable=false) 36 | private String schoolName; 37 | 38 | @Column(name="program_name", nullable=false) 39 | private String programName; 40 | 41 | @Column(name="start_date", nullable=false) 42 | private LocalDate startDate; 43 | 44 | @Column(name="graduation_date") 45 | private LocalDate graduationDate; 46 | 47 | @ManyToOne(targetEntity = Cv.class, fetch = FetchType.EAGER) 48 | @JoinColumn(name = "cv_id", insertable = false, updatable = false) 49 | @JsonIgnore 50 | private Cv cv; 51 | 52 | 53 | @JoinColumn(name = "cv_id", insertable = false, updatable = false) 54 | @Column(name="cv_id") 55 | private int cvId; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Employee.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.PrimaryKeyJoinColumn; 6 | import javax.persistence.Table; 7 | 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | import lombok.NoArgsConstructor; 12 | 13 | @Data 14 | @EqualsAndHashCode(callSuper=false) 15 | @Entity 16 | @Table(name = "employees") 17 | @PrimaryKeyJoinColumn(name = "user_id") 18 | @AllArgsConstructor 19 | @NoArgsConstructor 20 | public class Employee extends User{ 21 | 22 | @Column(name = "first_name") 23 | private String firstName; 24 | 25 | @Column(name = "last_name") 26 | private String lastName; 27 | 28 | public Employee( 29 | String email, 30 | String password, 31 | String firstName, 32 | String lastName, 33 | String activationCode) { 34 | super(email, password, activationCode); 35 | this.firstName = firstName; 36 | this.lastName = lastName; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Employer.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.util.List; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.OneToMany; 8 | import javax.persistence.PrimaryKeyJoinColumn; 9 | import javax.persistence.Table; 10 | 11 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 12 | 13 | import lombok.AllArgsConstructor; 14 | import lombok.Data; 15 | import lombok.EqualsAndHashCode; 16 | import lombok.NoArgsConstructor; 17 | 18 | @Data 19 | @EqualsAndHashCode(callSuper=false) 20 | @Entity 21 | @AllArgsConstructor 22 | @NoArgsConstructor 23 | @PrimaryKeyJoinColumn(name="user_id", referencedColumnName="id") 24 | @Table(name="employers") 25 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","jobAdvertisements"}) 26 | public class Employer extends User{ 27 | 28 | @Column(name="company_name") 29 | private String companyName; 30 | 31 | @Column(name="website") 32 | private String website; 33 | 34 | @Column(name="phone_number") 35 | private String phoneNumber; 36 | 37 | @Column(name="admin_confirm", columnDefinition = "boolean default false") 38 | private boolean adminConfirm = false; 39 | 40 | @OneToMany(mappedBy = "employer") 41 | private List jobAdvertisements; 42 | 43 | 44 | public Employer( 45 | String email, 46 | String password, 47 | String companyName, 48 | String website, 49 | String phoneNumber, 50 | String activationCode) { 51 | super(email, password, activationCode); 52 | this.companyName = companyName; 53 | this.website = website; 54 | this.phoneNumber = phoneNumber; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Experience.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.time.LocalDate; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.FetchType; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | import javax.persistence.JoinColumn; 12 | import javax.persistence.ManyToOne; 13 | import javax.persistence.PrimaryKeyJoinColumn; 14 | import javax.persistence.Table; 15 | 16 | import com.fasterxml.jackson.annotation.JsonIgnore; 17 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 18 | 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | @Data 24 | @Entity 25 | @Table(name="experiences") 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","cv"}) 29 | @PrimaryKeyJoinColumn(name="cv_id",referencedColumnName = "cv_id") 30 | public class Experience { 31 | 32 | @Id 33 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 34 | @Column(name="experience_id") 35 | private int id; 36 | 37 | @Column(name="workplace_name", nullable=false) 38 | private String workplaceName; 39 | 40 | @Column(name="job_title", nullable=false) 41 | private String jobTitle; 42 | 43 | @Column(name="start_date", nullable=false) 44 | private LocalDate startDate; 45 | 46 | @Column(name="departure_date") 47 | private LocalDate departureDate; 48 | 49 | @JoinColumn(name = "cv_id", insertable = false, updatable = false) 50 | @ManyToOne(targetEntity = Cv.class, fetch = FetchType.EAGER) 51 | @JsonIgnore 52 | private Cv cv; 53 | 54 | @Column(name = "cv_id") 55 | private int cvId; 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/JobAdvertisement.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.time.LocalDate; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.GenerationType; 9 | import javax.persistence.Id; 10 | import javax.persistence.JoinColumn; 11 | import javax.persistence.ManyToOne; 12 | import javax.persistence.Table; 13 | 14 | import lombok.AllArgsConstructor; 15 | import lombok.Data; 16 | import lombok.NoArgsConstructor; 17 | 18 | @Data 19 | @Entity 20 | @AllArgsConstructor 21 | @NoArgsConstructor 22 | @Table(name="job_advertisements") 23 | public class JobAdvertisement { 24 | @Id 25 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 26 | @Column(name="advertisement_id", nullable=false) 27 | private int advertisementId; 28 | 29 | @Column(name="job_definition", nullable=false) 30 | private String jobDefinition; 31 | 32 | @Column(name="min_salary", nullable=true) 33 | private double minSalary; 34 | 35 | @Column(name="max_salary", nullable=true) 36 | private double maxSalary; 37 | 38 | @Column(name="number_of_open_positions", nullable=false) 39 | private short numberOfOpenPositions; 40 | 41 | @Column(name="created_date", columnDefinition = "Date defult CURRENT_DATE") 42 | private LocalDate createdDate = LocalDate.now(); 43 | 44 | @Column(name="expiration_date", nullable=true) 45 | private LocalDate expirationDate; 46 | 47 | @Column(name= "is_active", columnDefinition = "boolean default true") 48 | private boolean active = true; 49 | 50 | @ManyToOne() 51 | @JoinColumn(name="city_id") 52 | private City city; 53 | 54 | @ManyToOne() 55 | @JoinColumn(name="employer_id") 56 | private Employer employer; 57 | 58 | @ManyToOne() 59 | @JoinColumn(name="position_id") 60 | private JobPosition jobPosition; 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/JobPosition.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.util.List; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.GenerationType; 9 | import javax.persistence.Id; 10 | import javax.persistence.OneToMany; 11 | import javax.persistence.Table; 12 | 13 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 14 | 15 | import lombok.AllArgsConstructor; 16 | import lombok.Data; 17 | import lombok.NoArgsConstructor; 18 | 19 | @Data 20 | @Entity 21 | @Table(name="job_positions") 22 | @AllArgsConstructor 23 | @NoArgsConstructor 24 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","jobAdvertisements"}) 25 | public class JobPosition { 26 | 27 | @Id 28 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 29 | @Column(name="position_id") 30 | private int id; 31 | 32 | @Column(name="position_name") 33 | private String positionName; 34 | 35 | @Column(name="position_description") 36 | private String description; 37 | 38 | @OneToMany(mappedBy = "jobPosition") 39 | private List jobAdvertisements; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Photo.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.time.LocalDate; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.FetchType; 8 | import javax.persistence.GeneratedValue; 9 | import javax.persistence.GenerationType; 10 | import javax.persistence.Id; 11 | import javax.persistence.JoinColumn; 12 | import javax.persistence.ManyToOne; 13 | import javax.persistence.PrimaryKeyJoinColumn; 14 | import javax.persistence.Table; 15 | 16 | import com.fasterxml.jackson.annotation.JsonIgnore; 17 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 18 | 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | @Data 24 | @Entity 25 | @Table(name="photos") 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","cv"}) 29 | @PrimaryKeyJoinColumn(name="cv_id",referencedColumnName = "cv_id") 30 | public class Photo { 31 | 32 | @Id 33 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 34 | @Column(name="photo_id") 35 | private int id; 36 | 37 | @Column(name="title") 38 | private String title; 39 | 40 | @Column(name="image") 41 | private String image; 42 | 43 | @Column(name="created_date", columnDefinition = "Date defult CURRENT_DATE") 44 | private LocalDate createdDate = LocalDate.now(); 45 | 46 | @JoinColumn(name = "cv_id", insertable = false, updatable = false) 47 | @ManyToOne(targetEntity = Cv.class, fetch = FetchType.EAGER) 48 | @JsonIgnore 49 | private Cv cv; 50 | 51 | @Column(name = "cv_id") 52 | private int cvId; 53 | 54 | public Photo(String title, String image) { 55 | super(); 56 | this.title = title; 57 | this.image = image; 58 | } 59 | 60 | /* 61 | * public StoredFile getUpload() { StoredFile file = new StoredFile(); 62 | * file.setPreloadedFile(image); return file; } 63 | * 64 | * public void setUpload(StoredFile file) { this.image = 65 | * file.getPreloadedFile(); } 66 | */ 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/Skill.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.FetchType; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.GenerationType; 8 | import javax.persistence.Id; 9 | import javax.persistence.JoinColumn; 10 | import javax.persistence.ManyToOne; 11 | import javax.persistence.PrimaryKeyJoinColumn; 12 | import javax.persistence.Table; 13 | 14 | import com.fasterxml.jackson.annotation.JsonIgnore; 15 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 16 | 17 | import lombok.AllArgsConstructor; 18 | import lombok.Data; 19 | import lombok.NoArgsConstructor; 20 | 21 | @Data 22 | @Entity 23 | @Table(name="skills") 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | @JsonIgnoreProperties({"hibernateLazyInitializer","handler","cv"}) 27 | @PrimaryKeyJoinColumn(name="cv_id",referencedColumnName = "cv_id") 28 | public class Skill { 29 | 30 | @Id 31 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 32 | @Column(name="skill_id") 33 | private int id; 34 | 35 | @Column(name="skill", nullable=false) 36 | private String skill; 37 | 38 | @Column(name="skill_level") 39 | private int skillLevel; 40 | 41 | @JoinColumn(name = "cv_id", insertable = false, updatable = false) 42 | @ManyToOne(targetEntity = Cv.class, fetch = FetchType.EAGER) 43 | @JsonIgnore 44 | private Cv cv; 45 | 46 | @Column(name = "cv_id") 47 | private int cvId; 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/concretes/User.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.concretes; 2 | 3 | import java.time.LocalDate; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.GenerationType; 9 | import javax.persistence.Id; 10 | import javax.persistence.Inheritance; 11 | import javax.persistence.InheritanceType; 12 | import javax.persistence.Table; 13 | 14 | 15 | import lombok.AllArgsConstructor; 16 | import lombok.Data; 17 | import lombok.NoArgsConstructor; 18 | 19 | 20 | @Entity 21 | @Table(name = "users") 22 | @Data 23 | @Inheritance(strategy = InheritanceType.JOINED) 24 | @NoArgsConstructor 25 | @AllArgsConstructor 26 | public class User { 27 | 28 | @Id 29 | @GeneratedValue(strategy = GenerationType.IDENTITY ) 30 | @Column(name= "id") 31 | private int id; 32 | 33 | @Column(name= "email") 34 | private String email; 35 | 36 | @Column(name= "password") 37 | private String password; 38 | 39 | @Column(name= "register_date", columnDefinition = "Date defult CURRENT_DATE") 40 | private LocalDate registerDate = LocalDate.now(); 41 | 42 | @Column(name= "activation_code") 43 | private String activationCode; 44 | 45 | @Column(name= "is_active", columnDefinition = "boolean default false") 46 | private boolean active = false; 47 | 48 | @Column(name= "is_deleted", columnDefinition = "boolean default false") 49 | private boolean deleted = false; 50 | 51 | public User(String email, String password, String activationCode) { 52 | this.email = email; 53 | this.password = password; 54 | this.activationCode = activationCode; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/dtos/CandidateForRegisterDto.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.dtos; 2 | 3 | import kodlamaio.hrms.entities.abstracts.ValidatableUser; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | public class CandidateForRegisterDto implements ValidatableUser { 12 | private String firstName; 13 | private String lastName; 14 | private String nationalityId; 15 | private Integer yearOfBirth; 16 | private String email; 17 | private String password; 18 | private String repassword; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/dtos/CvDto.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.dtos; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | import org.springframework.web.multipart.MultipartFile; 7 | 8 | import com.fasterxml.jackson.annotation.JsonIgnore; 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | 11 | import kodlamaio.hrms.entities.concretes.Candidate; 12 | import kodlamaio.hrms.entities.concretes.CvLanguage; 13 | import kodlamaio.hrms.entities.concretes.Education; 14 | import kodlamaio.hrms.entities.concretes.Experience; 15 | import kodlamaio.hrms.entities.concretes.Photo; 16 | import kodlamaio.hrms.entities.concretes.Skill; 17 | import lombok.AllArgsConstructor; 18 | import lombok.Data; 19 | import lombok.Getter; 20 | import lombok.NoArgsConstructor; 21 | import lombok.Setter; 22 | 23 | @Data 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | //@JsonIgnoreProperties(ignoreUnknown = true, 27 | //value ={"hibernateLazyInitializer","handler", 28 | // "languages", "educations", "experiences", "skills", "photos"}) 29 | public class CvDto { 30 | 31 | private int id; 32 | 33 | private String githubLink; 34 | 35 | private String linkedinLink; 36 | 37 | private String summary; 38 | 39 | private Candidate candidate; 40 | 41 | private List languages; 42 | 43 | private List educations; 44 | 45 | private List experiences; 46 | 47 | private List skills; 48 | 49 | private List photos; 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/dtos/EmployerForRegisterDto.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.dtos; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class EmployerForRegisterDto { 11 | private String email; 12 | private String companyName; 13 | private String website; 14 | private String phoneNumber; 15 | private String password; 16 | private String repassword; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/dtos/JobAdvertisementDto.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.dtos; 2 | 3 | import java.time.LocalDate; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class JobAdvertisementDto { 13 | 14 | private int advertisementId; 15 | private String companyName; 16 | private String positionName; 17 | private short numberOfOpenPositions; 18 | private LocalDate createdDate; 19 | private LocalDate expirationDate; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/kodlamaio/hrms/entities/dtos/UserForLoginDto.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms.entities.dtos; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class UserForLoginDto { 11 | private String email; 12 | private String password; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect 2 | spring.jpa.hibernate.ddl-auto=update 3 | spring.jpa.hibernate.show-sql=true 4 | spring.datasource.url=jdbc:postgresql://localhost:5432/Hrms 5 | spring.datasource.username=postgres 6 | spring.datasource.password=1103 7 | spring.jpa.properties.javax.persistence.validation.mode = none 8 | -------------------------------------------------------------------------------- /src/test/java/kodlamaio/hrms/HrmsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package kodlamaio.hrms; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class HrmsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | --------------------------------------------------------------------------------