Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ipmworks_backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ipmworks
ipmworks_backend
Commits
d480b325
Commit
d480b325
authored
Apr 30, 2024
by
Danijela Boberic Krsticev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some minor changes
parent
184f79bf
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
3 deletions
+56
-3
src/main/java/ipm/ipmworks/control/AdminResourceController.java
+11
-0
src/main/java/ipm/ipmworks/control/ResourceController.java
+0
-0
src/main/java/ipm/ipmworks/model/Comment.java
+11
-0
src/main/java/ipm/ipmworks/model/Resource.java
+13
-3
src/main/java/ipm/ipmworks/service/EmailService.java
+21
-0
No files found.
src/main/java/ipm/ipmworks/control/AdminResourceController.java
View file @
d480b325
...
@@ -35,6 +35,17 @@ public class AdminResourceController {
...
@@ -35,6 +35,17 @@ public class AdminResourceController {
if
(
resource
.
isPresent
()){
if
(
resource
.
isPresent
()){
Resource
r
=
resource
.
get
();
Resource
r
=
resource
.
get
();
r
.
setApproved
(
true
);
r
.
setApproved
(
true
);
r
.
setHide
(
false
);
resourceRepository
.
save
(
r
);
}
}
@GetMapping
(
"/archive/{id}"
)
public
void
archiveResource
(
@PathVariable
(
"id"
)
String
idResource
){
Optional
<
Resource
>
resource
=
resourceRepository
.
findById
(
idResource
);
if
(
resource
.
isPresent
()){
Resource
r
=
resource
.
get
();
r
.
setApproved
(
false
);
r
.
setHide
(
true
);
resourceRepository
.
save
(
r
);
resourceRepository
.
save
(
r
);
}
}
}
}
...
...
src/main/java/ipm/ipmworks/control/ResourceController.java
View file @
d480b325
This diff is collapsed.
Click to expand it.
src/main/java/ipm/ipmworks/model/Comment.java
0 → 100644
View file @
d480b325
package
ipm
.
ipmworks
.
model
;
import
lombok.Getter
;
import
lombok.Setter
;
@Getter
@Setter
public
class
Comment
{
private
String
text
;
private
String
commenterEmail
;
}
src/main/java/ipm/ipmworks/model/Resource.java
View file @
d480b325
package
ipm
.
ipmworks
.
model
;
package
ipm
.
ipmworks
.
model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.annotation.Transient
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -29,7 +38,8 @@ public class Resource {
...
@@ -29,7 +38,8 @@ public class Resource {
private
String
contactPhone
;
private
String
contactPhone
;
private
String
contactAddress
;
private
String
contactAddress
;
private
List
<
String
>
links
=
new
ArrayList
<
String
>();
private
List
<
Link
>
links
=
new
ArrayList
<
Link
>();
private
String
youtube
;
private
List
<
Map
>
files
=
new
ArrayList
();
private
List
<
Map
>
files
=
new
ArrayList
();
private
String
project
;
private
String
project
;
private
String
projectWeb
;
private
String
projectWeb
;
...
@@ -42,9 +52,9 @@ public class Resource {
...
@@ -42,9 +52,9 @@ public class Resource {
private
User
approvedBy
;
private
User
approvedBy
;
private
List
<
Pest
>
pests
=
new
ArrayList
<
Pest
>();
private
List
<
Pest
>
pests
=
new
ArrayList
<
Pest
>();
private
List
<
Crop
>
crops
=
new
ArrayList
<
Crop
>();
private
List
<
Crop
>
crops
=
new
ArrayList
<
Crop
>();
private
List
<
User
>
likes
=
new
ArrayList
<
User
>();
private
LocalDateTime
creationDate
;
private
Date
creationDate
;
private
boolean
approved
;
private
boolean
approved
;
private
boolean
canEdit
;
private
boolean
canEdit
;
private
boolean
external
;
private
boolean
external
;
private
boolean
hide
;
}
}
src/main/java/ipm/ipmworks/service/EmailService.java
0 → 100644
View file @
d480b325
package
ipm
.
ipmworks
.
service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.mail.SimpleMailMessage
;
import
org.springframework.mail.javamail.JavaMailSender
;
import
org.springframework.stereotype.Service
;
@Service
public
class
EmailService
{
@Autowired
private
JavaMailSender
javaMailSender
;
public
void
sendEmail
(
String
receiver
,
String
subject
,
String
body
)
{
SimpleMailMessage
msg
=
new
SimpleMailMessage
();
msg
.
setTo
(
receiver
);
msg
.
setSubject
(
subject
);
msg
.
setText
(
body
);
javaMailSender
.
send
(
msg
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment