Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Wendys Racing Horses
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
tu-wien
Wendys Racing Horses
Commits
3b1bae09
Commit
3b1bae09
authored
Apr 05, 2020
by
Ivaylo Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
US07: Fix bug where all whitespaces were considered valid input on owner update
parent
8e373684
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
25 deletions
+25
-25
backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/persistence/impl/OwnerJdbcDao.java
.../assignment/individual/persistence/impl/OwnerJdbcDao.java
+1
-1
backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/util/Validator.java
.../ac/tuwien/sepm/assignment/individual/util/Validator.java
+1
-1
frontend/wendys-friends/src/app/component/add-owner/add-owner.component.html
...ends/src/app/component/add-owner/add-owner.component.html
+1
-1
frontend/wendys-friends/src/app/component/update-owner/update-owner.component.html
...rc/app/component/update-owner/update-owner.component.html
+22
-22
No files found.
backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/persistence/impl/OwnerJdbcDao.java
View file @
3b1bae09
...
...
@@ -165,7 +165,7 @@ public class OwnerJdbcDao implements OwnerDao {
int
changes
=
jdbcTemplate
.
update
(
connection
->
{
PreparedStatement
ps
=
connection
.
prepareStatement
(
sql
);
ps
.
setString
(
1
,
owner
.
getName
());
ps
.
setString
(
1
,
owner
.
getName
()
.
trim
()
);
ps
.
setObject
(
2
,
owner
.
getUpdatedAt
());
ps
.
setObject
(
3
,
owner
.
getId
());
return
ps
;
...
...
backend/src/main/java/at/ac/tuwien/sepm/assignment/individual/util/Validator.java
View file @
3b1bae09
...
...
@@ -21,7 +21,7 @@ public class Validator {
if
(
owner
.
getId
()
==
null
||
owner
.
getId
()
==
0
)
{
throw
new
ValidationException
(
"Owner Id cannot be null or 0"
);
}
if
(
owner
.
getName
()
==
null
||
owner
.
getName
().
isEmpty
())
{
if
(
owner
.
getName
()
==
null
||
owner
.
getName
().
isEmpty
()
||
owner
.
getName
().
isBlank
()
)
{
throw
new
ValidationException
(
"Required value for owner missing: name"
);
}
}
...
...
frontend/wendys-friends/src/app/component/add-owner/add-owner.component.html
View file @
3b1bae09
...
...
@@ -17,7 +17,7 @@
<form
(ngSubmit)=
"addOwner()"
#ownerForm
="
ngForm
"
>
<div
class=
"form-group"
>
<label
for=
"name"
>
Name
</label>
<input
type=
"text"
class=
"form-control"
name=
"name"
[(ngModel)]=
"owner.name"
pattern=
"\
s*\
S+.*"
required
>
<input
type=
"text"
class=
"form-control"
name=
"name"
[(ngModel)]=
"owner.name"
pattern=
"\S+.*"
required
>
</div>
<button
type=
"submit"
class=
"btn btn-success"
[disabled]=
"!ownerForm.form.valid"
(submit)=
"addOwner()"
>
Submit
</button>
...
...
frontend/wendys-friends/src/app/component/update-owner/update-owner.component.html
View file @
3b1bae09
<div
*ngIf=
"error"
class=
"alert alert-danger alert-dismissible fade show"
role=
"alert"
>
<strong>
Error!
</strong>
{{ errorMessage }}
<button
type=
"button"
(click)=
"vanishError()"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<strong>
Error!
</strong>
{{ errorMessage }}
<button
type=
"button"
(click)=
"vanishError()"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
*ngIf=
"success"
class=
"alert alert-success alert-dismissible fade show"
role=
"alert"
>
<p><strong>
Success!
</strong>
Owner {{ success }} has been successfully updated.
</p>
<button
type=
"button"
(click)=
"vanishAlert()"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
*ngIf=
"success"
class=
"alert alert-success alert-dismissible fade show"
role=
"alert"
>
<p><strong>
Success!
</strong>
Owner {{ success }} has been successfully updated.
</p>
<button
type=
"button"
(click)=
"vanishAlert()"
class=
"close"
data-dismiss=
"alert"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"container"
>
<h1>
Update owner
</h1>
<form
(ngSubmit)=
"updateOwner()"
#ownerForm
="
ngForm
"
>
<div
class=
"form-group"
>
<label
for=
"name"
>
Name
</label>
<input
type=
"text"
class=
"form-control"
name=
"name
"
[(ngModel)]=
"owner.name"
required
>
</div>
<div
class=
"container"
>
<h1>
Update owner
</h1>
<form
(ngSubmit)=
"updateOwner()"
#ownerForm
="
ngForm
"
>
<div
class=
"form-group"
>
<label
for=
"name"
>
Name
</label>
<input
type=
"text"
class=
"form-control"
name=
"name"
pattern=
"\S+.*
"
[(ngModel)]=
"owner.name"
required
>
</div>
<button
type=
"submit"
class=
"btn btn-success float-left"
[disabled]=
"!ownerForm.form.valid"
(submit)=
"updateOwner()"
>
Submit
</button>
<a
class=
"btn btn-light float-right"
href=
"owner"
>
Cancel
</a>
</form>
</div>
\ No newline at end of file
<button
type=
"submit"
class=
"btn btn-success float-left"
[disabled]=
"!ownerForm.form.valid"
(submit)=
"updateOwner()"
>
Submit
</button>
<a
class=
"btn btn-light float-right"
href=
"owner"
>
Cancel
</a>
</form>
</div>
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