Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Hao-Hsiang Song
/
topics-auction
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a1231b2f
authored
Dec 02, 2018
by
Bright Sukumpanumet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove .toString
parent
99535670
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
42 deletions
package-lock.json
src/main/java/edu/uchicago/mpcs/topics/controller/BidController.java
src/main/java/edu/uchicago/mpcs/topics/controller/UserController.java
src/main/java/edu/uchicago/mpcs/topics/db/UserDB.java
src/main/java/edu/uchicago/mpcs/topics/service/BidService.java
src/main/java/edu/uchicago/mpcs/topics/service/MailService.java
src/main/java/edu/uchicago/mpcs/topics/user/WatchList.java
src/main/resources/static/built/bundle.js.map
package-lock.json
View file @
a1231b2f
...
...
@@ -2253,12 +2253,14 @@
"balanced-match"
:
{
"version"
:
"1.0.0"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"brace-expansion"
:
{
"version"
:
"1.1.11"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"balanced-match"
:
"^1.0.0"
,
"concat-map"
:
"0.0.1"
...
...
@@ -2273,17 +2275,20 @@
"code-point-at"
:
{
"version"
:
"1.1.0"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"concat-map"
:
{
"version"
:
"0.0.1"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"console-control-strings"
:
{
"version"
:
"1.1.0"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"core-util-is"
:
{
"version"
:
"1.0.2"
,
...
...
@@ -2400,7 +2405,8 @@
"inherits"
:
{
"version"
:
"2.0.3"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"ini"
:
{
"version"
:
"1.3.5"
,
...
...
@@ -2412,6 +2418,7 @@
"version"
:
"1.0.0"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"number-is-nan"
:
"^1.0.0"
}
...
...
@@ -2426,6 +2433,7 @@
"version"
:
"3.0.4"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"brace-expansion"
:
"^1.1.7"
}
...
...
@@ -2433,12 +2441,14 @@
"minimist"
:
{
"version"
:
"0.0.8"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"minipass"
:
{
"version"
:
"2.2.4"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"safe-buffer"
:
"^5.1.1"
,
"yallist"
:
"^3.0.0"
...
...
@@ -2457,6 +2467,7 @@
"version"
:
"0.5.1"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"minimist"
:
"0.0.8"
}
...
...
@@ -2537,7 +2548,8 @@
"number-is-nan"
:
{
"version"
:
"1.0.1"
,
"bundled"
:
true
,
"dev"
:
true
"dev"
:
true
,
"optional"
:
true
},
"object-assign"
:
{
"version"
:
"4.1.1"
,
...
...
@@ -2549,6 +2561,7 @@
"version"
:
"1.4.0"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"wrappy"
:
"1"
}
...
...
@@ -2670,6 +2683,7 @@
"version"
:
"1.0.2"
,
"bundled"
:
true
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"code-point-at"
:
"^1.0.0"
,
"is-fullwidth-code-point"
:
"^1.0.0"
,
...
...
src/main/java/edu/uchicago/mpcs/topics/controller/BidController.java
View file @
a1231b2f
...
...
@@ -37,11 +37,11 @@ public class BidController
return
bidService
.
addBid
(
bid
);
}
@GetMapping
(
"/email"
)
// JUST FOR TESTING
public
void
email
()
throws
UnsupportedEncodingException
{
mailService
.
sendEmailWithoutTemplating
();
}
//
@GetMapping("/email") // JUST FOR TESTING
//
public void email() throws UnsupportedEncodingException
//
{
//
mailService.sendEmailWithoutTemplating();
//
}
@GetMapping
(
"/{userId}"
)
public
List
<
Bid
>
getBidsByUser
(
@PathVariable
Long
userId
)
...
...
src/main/java/edu/uchicago/mpcs/topics/controller/UserController.java
View file @
a1231b2f
...
...
@@ -35,9 +35,9 @@ public class UserController {
@RequestMapping
(
method
=
POST
,
value
=
"/register"
)
public
ResponseEntity
<?>
addUser
(
@RequestBody
User
user
,
UriComponentsBuilder
ucBuilder
)
{
User
existUser
=
this
.
userService
.
findByUserId
(
user
.
getUserId
()
.
toString
()
)
;
User
existUser
=
this
.
userService
.
findByUserId
(
user
.
getUserId
())
;
if
(
existUser
!=
null
)
{
throw
new
UserAlreadyExistException
(
user
.
getUserId
()
.
toString
()
,
"Username already exists"
);
throw
new
UserAlreadyExistException
(
user
.
getUserId
(),
"Username already exists"
);
}
User
new_user
=
this
.
userService
.
register
(
user
);
HttpHeaders
headers
=
new
HttpHeaders
();
...
...
@@ -57,7 +57,7 @@ public class UserController {
* Get user.
*/
@GetMapping
(
"/{userId}"
)
public
User
getUserById
(
@PathVariable
Stri
ng
userId
)
public
User
getUserById
(
@PathVariable
Lo
ng
userId
)
{
return
userRepository
.
findById
(
userId
).
orElse
(
null
);
}
...
...
src/main/java/edu/uchicago/mpcs/topics/db/UserDB.java
View file @
a1231b2f
...
...
@@ -8,7 +8,7 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import
java.util.List
;
@RepositoryRestResource
public
interface
UserDB
extends
CrudRepository
<
User
,
Stri
ng
>
{
public
interface
UserDB
extends
CrudRepository
<
User
,
Lo
ng
>
{
User
findByEmail
(
@Param
(
"email"
)
String
email
);
User
findByUserId
(
@Param
(
"user_id"
)
Long
userId
);
...
...
src/main/java/edu/uchicago/mpcs/topics/service/BidService.java
View file @
a1231b2f
...
...
@@ -6,13 +6,11 @@ import edu.uchicago.mpcs.topics.auction.Status;
import
edu.uchicago.mpcs.topics.controller.ItemController
;
import
edu.uchicago.mpcs.topics.db.BidRepository
;
import
edu.uchicago.mpcs.topics.db.ItemRepository
;
import
edu.uchicago.mpcs.topics.db.UserDB
;
import
edu.uchicago.mpcs.topics.db.UserRepository
;
import
edu.uchicago.mpcs.topics.user.User
;
import
org.springframework.stereotype.Service
;
import
java.io.UnsupportedEncodingException
;
import
java.util.Optional
;
/**
* Created by Bright on 2018-11-18.
...
...
@@ -52,14 +50,14 @@ public class BidService
if
(
itemToUpdate
.
getStatus
()
!=
Status
.
HASBID
)
{
User
seller
=
userRepository
.
findById
(
itemToUpdate
.
getSellerId
()).
orElseThrow
(
NullPointerException:
:
new
);
mailService
.
sendEmail
f
irstBid
(
seller
.
getEmail
());
mailService
.
sendEmail
F
irstBid
(
seller
.
getEmail
());
}
//send email to previous bidder
User
currentBidder
=
userRepository
.
findById
(
itemToUpdate
.
getCurrentBidderID
()).
orElseThrow
(
NullPointerException:
:
new
);
mailService
.
sendEmail
o
utBid
(
currentBidder
.
getEmail
());
mailService
.
sendEmail
O
utBid
(
currentBidder
.
getEmail
());
//Assign highest bidder and set status
itemToUpdate
.
setCurrentBidderID
(
bid
.
getUserId
());
...
...
src/main/java/edu/uchicago/mpcs/topics/service/MailService.java
View file @
a1231b2f
...
...
@@ -2,7 +2,6 @@ package edu.uchicago.mpcs.topics.service;
import
com.google.common.collect.Lists
;
import
edu.uchicago.mpcs.topics.auction.Item
;
import
it.ozimov.springboot.mail.model.Email
;
import
it.ozimov.springboot.mail.model.defaultimpl.DefaultEmail
;
import
it.ozimov.springboot.mail.service.EmailService
;
...
...
@@ -22,23 +21,23 @@ public class MailService
@Autowired
public
EmailService
emailService
;
public
void
sendEmail
o
utBid
(
String
emailAddress
)
throws
UnsupportedEncodingException
public
void
sendEmail
O
utBid
(
String
emailAddress
)
throws
UnsupportedEncodingException
{
// this.sendEmailWithoutTemplating();
}
public
void
sendEmail
f
irstBid
(
String
emailAddress
)
throws
UnsupportedEncodingException
public
void
sendEmail
F
irstBid
(
String
emailAddress
)
throws
UnsupportedEncodingException
{
// this.sendEmailWithoutTemplating();
}
public
void
sendEmailWithoutTemplating
()
throws
UnsupportedEncodingException
public
void
sendEmailWithoutTemplating
(
String
emailAddress
,
String
body
)
throws
UnsupportedEncodingException
{
final
Email
email
=
DefaultEmail
.
builder
()
.
from
(
new
InternetAddress
(
"topicsauction@gmail.com"
,
"Topics Auction"
))
.
to
(
Lists
.
newArrayList
(
new
InternetAddress
(
"topicsauction@gmail.com"
,
"Pomponius Attĭcus"
)))
.
subject
(
"You have been outbid!"
)
.
body
(
"
Firmamentum autem stabilitatis constantiaeque eius, quam in amicitia quaerimus, fides est."
)
.
body
(
"
Sent to "
+
emailAddress
+
body
)
.
encoding
(
"UTF-8"
).
build
();
emailService
.
send
(
email
);
...
...
src/main/java/edu/uchicago/mpcs/topics/user/WatchList.java
deleted
100644 → 0
View file @
99535670
package
edu
.
uchicago
.
mpcs
.
topics
.
user
;
import
edu.uchicago.mpcs.topics.auction.Item
;
import
java.util.List
;
//
//public class WatchList {
// private List<Item> items;
//
// public List<Item> getItems() {
// return items;
// }
//
// public void setItems(List<Item> items) {
// this.items = items;
// }
//}
src/main/resources/static/built/bundle.js.map
View file @
a1231b2f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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