-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'docs' of https://github.com/kavicastelo/Ethical-AI-driv…
…en-Geographic-Analytics-Platform into docs
- Loading branch information
Showing
6 changed files
with
139 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
build-frontend: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: | | ||
cd client | ||
npm install --force | ||
- name: Build frontend | ||
run: | | ||
cd client | ||
npm run build | ||
build-backend: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
- name: Build backend | ||
run: | | ||
chmod +x ./mvnw | ||
./mvnw clean package |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
src/main/java/com/api/air_quality/controller/ContactController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,42 @@ | ||
package com.api.air_quality.controller; | ||
|
||
import com.api.air_quality.dto.ApiResponse; | ||
import com.api.air_quality.model.ContactModel; | ||
import com.api.air_quality.repository.ContactRepository; | ||
import com.api.air_quality.service.EmailService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class ContactController { | ||
|
||
@Autowired | ||
ContactRepository contactRepository; | ||
|
||
@Autowired | ||
EmailService emailService; | ||
|
||
@PostMapping("/api/v1/contact") | ||
public ResponseEntity<ApiResponse> sendMail(@RequestBody ContactModel contactModel){ | ||
emailService.sendSimpleEmail("[email protected]","Urban air quality platform - contact","" + | ||
"Dear Administration,"+"\n" + | ||
"You got an contact email from: "+contactModel.getName()+"\n" + | ||
"Email Address: "+contactModel.getEmail()+"\n\n" + | ||
""+contactModel.getMessage()+"\n\n" + | ||
"Client is waiting for your response. Reply ASAP\n\n\n" + | ||
"System Automated Email - Urban Air Quality Platform"); | ||
|
||
emailService.sendSimpleEmail(contactModel.getEmail(),"Urban air quality platform - contact","" + | ||
"Dear "+contactModel.getName()+","+"\n" + | ||
"We got your contact message. Our agent will be contact you ASAP. Thank you for contacting with us! \n\n" + | ||
"Sincerely,\n" + | ||
"Urban Air Quality Platform.\n\n" + | ||
"Note:- Don't reply to this email. This is system automated email."); | ||
|
||
ApiResponse response = new ApiResponse("Contact message sent successfully!"); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
package com.api.air_quality.model; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
|
||
@Document(collection = "contact") | ||
public class ContactModel { | ||
@Id | ||
private String id; | ||
private String name; | ||
private String email; | ||
private String message; | ||
} |
5 changes: 4 additions & 1 deletion
5
src/main/java/com/api/air_quality/repository/ContactRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
package com.api.air_quality.repository; | ||
|
||
public interface ContactRepository { | ||
import com.api.air_quality.model.ContactModel; | ||
import org.springframework.data.mongodb.repository.MongoRepository; | ||
|
||
public interface ContactRepository extends MongoRepository<ContactModel, String> { | ||
} |