Skip to content

Commit

Permalink
Implemented CP #23
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaugarcia committed Mar 18, 2017
1 parent dea5566 commit 6fa6b7e
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 25 deletions.
15 changes: 11 additions & 4 deletions .jhipster/Location.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,18 @@
{
"fieldName": "longitude",
"fieldType": "Double"
},
{
"fieldName": "cp",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
}
],
"changelogDate": "20170210193421",
"entityTableName": "location",
"dto": "no",
"pagination": "pagination",
"service": "no"
}
"service": "no",
"entityTableName": "location",
"pagination": "pagination"
}
3 changes: 2 additions & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"es",
"ca",
"en"
]
],
"serviceDiscoveryType": false
}
}
Binary file added Documentacion/Seguimiento/20170317.pdf
Binary file not shown.
5 changes: 3 additions & 2 deletions jhipster-jdl.jh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ entity Property{
ref String required,
visible Boolean,
sold Boolean,

//Facilities
terrace Boolean,
m2 Integer,
Expand All @@ -34,6 +34,7 @@ entity Location{
ref String,
province String required,
town String required,
cp required String,
typeOfRoad RoadType required,
nameRoad String required,
number Integer required,
Expand All @@ -43,7 +44,7 @@ entity Location{
stair String,
urlgmaps String,
latitude Double,
longitude Double,
longitude Double,
}

entity Photo{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.arnaugarcia.assessoriatorrelles.domain;

import com.arnaugarcia.assessoriatorrelles.domain.enumeration.RoadType;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;

import com.arnaugarcia.assessoriatorrelles.domain.enumeration.RoadType;

/**
* A Location.
*/
Expand Down Expand Up @@ -67,6 +66,10 @@ public class Location implements Serializable {
@Column(name = "longitude")
private Double longitude;

@NotNull
@Column(name = "cp", nullable = false)
private String cp;

@OneToOne(mappedBy = "location")
@JsonIgnore
private Company company;
Expand Down Expand Up @@ -252,6 +255,19 @@ public void setLongitude(Double longitude) {
this.longitude = longitude;
}

public String getCp() {
return cp;
}

public Location cp(String cp) {
this.cp = cp;
return this;
}

public void setCp(String cp) {
this.cp = cp;
}

public Company getCompany() {
return company;
}
Expand Down Expand Up @@ -315,6 +331,7 @@ public String toString() {
", urlgmaps='" + urlgmaps + "'" +
", latitude='" + latitude + "'" +
", longitude='" + longitude + "'" +
", cp='" + cp + "'" +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<constraints nullable="true" />
</column>

<column name="cp" type="varchar(255)">
<constraints nullable="false" />
</column>

<!-- jhipster-needle-liquibase-add-column - Jhipster will add columns here, do not remove-->
</createTable>

Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/app/entities/location/location-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ <h2><span data-translate="assessoriaTorrellesApp.location.detail.title">Location
<dd>
<span>{{vm.location.town}}</span>
</dd>
<dt><span data-translate="assessoriaTorrellesApp.location.cp">CP</span></dt>
<dd>
<span>{{vm.location.cp}}</span>
</dd>
<dt><span data-translate="assessoriaTorrellesApp.location.typeOfRoad">Type Of Road</span></dt>
<dd>
<span data-translate="{{'assessoriaTorrellesApp.RoadType.' + vm.location.typeOfRoad}}">{{vm.location.typeOfRoad}}</span>
Expand Down
12 changes: 12 additions & 0 deletions src/main/webapp/app/entities/location/location-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ <h4 class="modal-title" id="myLocationLabel" data-translate="assessoriaTorrelles
</p>
</div>
</div>
<div class="form-group">
<label class="control-label" data-translate="assessoriaTorrellesApp.location.cp" for="field_cp">cp</label>
<input type="text" class="form-control" name="cp" id="field_cp"
ng-model="vm.location.cp"
required />
<div ng-show="editForm.cp.$invalid">
<p class="help-block"
ng-show="editForm.cp.$error.required" data-translate="entity.validation.required">
This field is required.
</p>
</div>
</div>
<div class="form-group">
<label class="control-label" data-translate="assessoriaTorrellesApp.location.typeOfRoad" for="field_typeOfRoad">Type Of Road</label>
<select class="form-control" name="typeOfRoad" ng-model="vm.location.typeOfRoad" id="field_typeOfRoad" required>
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/app/entities/location/locations.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h2 data-translate="assessoriaTorrellesApp.location.home.title">Locations</h2>
<th jh-sort-by="ref"><span data-translate="assessoriaTorrellesApp.location.ref">Ref</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="province"><span data-translate="assessoriaTorrellesApp.location.province">Province</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="town"><span data-translate="assessoriaTorrellesApp.location.town">Town</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="cp"><span data-translate="assessoriaTorrellesApp.location.cp">CP</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="typeOfRoad"><span data-translate="assessoriaTorrellesApp.location.typeOfRoad">Type Of Road</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="nameRoad"><span data-translate="assessoriaTorrellesApp.location.nameRoad">Name Road</span> <span class="glyphicon glyphicon-sort"></span></th>
<th jh-sort-by="number"><span data-translate="assessoriaTorrellesApp.location.number">Number</span> <span class="glyphicon glyphicon-sort"></span></th>
Expand All @@ -41,6 +42,7 @@ <h2 data-translate="assessoriaTorrellesApp.location.home.title">Locations</h2>
<td>{{location.ref}}</td>
<td>{{location.province}}</td>
<td>{{location.town}}</td>
<td>{{location.cp}}</td>
<td data-translate="{{'assessoriaTorrellesApp.RoadType.' + location.typeOfRoad}}">{{location.typeOfRoad}}</td>
<td>{{location.nameRoad}}</td>
<td>{{location.number}}</td>
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/i18n/ca/location.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ref": "Ref",
"province": "Province",
"town": "Town",
"town": "Códic Postal",
"typeOfRoad": "Type Of Road",
"nameRoad": "Name Road",
"number": "Number",
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/i18n/en/location.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ref": "Ref",
"province": "Province",
"town": "Town",
"cp": "Postal Code",
"typeOfRoad": "Type Of Road",
"nameRoad": "Name Road",
"number": "Number",
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/i18n/es/location.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"ref": "Ref",
"province": "Province",
"town": "Town",
"cp": "Código postal",
"typeOfRoad": "Type Of Road",
"nameRoad": "Name Road",
"number": "Number",
Expand Down
25 changes: 14 additions & 11 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
<script src="app/services/auth/activate.service.js"></script>
<script src="app/services/auth/account.service.js"></script>
<script src="app/layouts/sidebar/sidebar.controller.js"></script>
<script src="app/layouts/header/header.controller.js"></script>
<script src="app/layouts/navbar/navbar.controller.js"></script>
<script src="app/layouts/footer/footer.controller.js"></script>
<script src="app/layouts/navbar/active-menu.directive.js"></script>
<script src="app/layouts/navbar/active-link.directive.js"></script>
<script src="app/layouts/header/header.controller.js"></script>
<script src="app/layouts/footer/footer.controller.js"></script>
<script src="app/layouts/error/error.state.js"></script>
<script src="app/home/home.state.js"></script>
<script src="app/home/home.controller.js"></script>
Expand All @@ -127,28 +127,31 @@
<script src="app/entities/photo/photo.state.js"></script>
<script src="app/entities/photo/photo.service.js"></script>
<script src="app/entities/photo/photo.controller.js"></script>
<script src="app/entities/notification/notification-dialog.controller.js"></script>
<script src="app/entities/notification/notification-detail.controller.js"></script>
<script src="app/entities/notification/notification-delete-dialog.controller.js"></script>
<script src="app/entities/notification/notification.state.js"></script>
<script src="app/entities/notification/notification.service.js"></script>
<script src="app/entities/notification/notification.controller.js"></script>
<script src="app/entities/location/location-dialog.controller.js"></script>
<script src="app/entities/location/location-detail.controller.js"></script>
<script src="app/entities/location/location-delete-dialog.controller.js"></script>
<script src="app/entities/location/location.state.js"></script>
<script src="app/entities/location/location.service.js"></script>
<script src="app/entities/location/location.controller.js"></script>
<script src="app/entities/entity.state.js"></script>
<script src="app/entities/contact/contact-dialog.controller.js"></script>
<script src="app/entities/contact/contact-detail.controller.js"></script>
<script src="app/entities/contact/contact-delete-dialog.controller.js"></script>
<script src="app/entities/contact/contact.state.js"></script>
<script src="app/entities/contact/contact.service.js"></script>
<script src="app/entities/contact/contact.controller.js"></script>
<script src="app/entities/company/company-dialog.controller.js"></script>
<script src="app/entities/company/company-detail.controller.js"></script>
<script src="app/entities/company/company-delete-dialog.controller.js"></script>
<script src="app/entities/company/company.state.js"></script>
<script src="app/entities/company/company.service.js"></script>
<script src="app/entities/company/company.controller.js"></script>
<script src="app/entities/contact/contact.state.js"></script>
<script src="app/entities/contact/contact.service.js"></script>
<script src="app/entities/contact/contact.controller.js"></script>
<script src="app/entities/notification/notification.controller.js"></script>
<script src="app/entities/notification/notification.service.js"></script>
<script src="app/entities/notification/notification.state.js"></script>
<script src="app/entities/notification/notification-delete-dialog.controller.js"></script>
<script src="app/entities/notification/notification-detail.controller.js"></script>
<script src="app/entities/notification/notification-dialog.controller.js"></script>
<script src="app/components/util/truncate-words.filter.js"></script>
<script src="app/components/util/truncate-characters.filter.js"></script>
<script src="app/components/util/sort-by.directive.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public class LocationResourceIntTest {
private static final Double DEFAULT_LONGITUDE = 1D;
private static final Double UPDATED_LONGITUDE = 2D;

private static final String DEFAULT_CP = "AAAAA";
private static final String UPDATED_CP = "BBBBB";

@Inject
private LocationRepository locationRepository;

Expand Down Expand Up @@ -124,7 +127,8 @@ public static Location createEntity(EntityManager em) {
.stair(DEFAULT_STAIR)
.urlgmaps(DEFAULT_URLGMAPS)
.latitude(DEFAULT_LATITUDE)
.longitude(DEFAULT_LONGITUDE);
.longitude(DEFAULT_LONGITUDE)
.cp(DEFAULT_CP);
return location;
}

Expand Down Expand Up @@ -162,6 +166,7 @@ public void createLocation() throws Exception {
assertThat(testLocation.getUrlgmaps()).isEqualTo(DEFAULT_URLGMAPS);
assertThat(testLocation.getLatitude()).isEqualTo(DEFAULT_LATITUDE);
assertThat(testLocation.getLongitude()).isEqualTo(DEFAULT_LONGITUDE);
assertThat(testLocation.getCp()).isEqualTo(DEFAULT_CP);
}

@Test
Expand Down Expand Up @@ -254,6 +259,24 @@ public void checkNumberIsRequired() throws Exception {
assertThat(locations).hasSize(databaseSizeBeforeTest);
}

@Test
@Transactional
public void checkCpIsRequired() throws Exception {
int databaseSizeBeforeTest = locationRepository.findAll().size();
// set the field null
location.setCp(null);

// Create the Location, which fails.

restLocationMockMvc.perform(post("/api/locations")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(location)))
.andExpect(status().isBadRequest());

List<Location> locations = locationRepository.findAll();
assertThat(locations).hasSize(databaseSizeBeforeTest);
}

@Test
@Transactional
public void getAllLocations() throws Exception {
Expand All @@ -277,7 +300,8 @@ public void getAllLocations() throws Exception {
.andExpect(jsonPath("$.[*].stair").value(hasItem(DEFAULT_STAIR.toString())))
.andExpect(jsonPath("$.[*].urlgmaps").value(hasItem(DEFAULT_URLGMAPS.toString())))
.andExpect(jsonPath("$.[*].latitude").value(hasItem(DEFAULT_LATITUDE.doubleValue())))
.andExpect(jsonPath("$.[*].longitude").value(hasItem(DEFAULT_LONGITUDE.doubleValue())));
.andExpect(jsonPath("$.[*].longitude").value(hasItem(DEFAULT_LONGITUDE.doubleValue())))
.andExpect(jsonPath("$.[*].cp").value(hasItem(DEFAULT_CP.toString())));
}

@Test
Expand All @@ -303,7 +327,8 @@ public void getLocation() throws Exception {
.andExpect(jsonPath("$.stair").value(DEFAULT_STAIR.toString()))
.andExpect(jsonPath("$.urlgmaps").value(DEFAULT_URLGMAPS.toString()))
.andExpect(jsonPath("$.latitude").value(DEFAULT_LATITUDE.doubleValue()))
.andExpect(jsonPath("$.longitude").value(DEFAULT_LONGITUDE.doubleValue()));
.andExpect(jsonPath("$.longitude").value(DEFAULT_LONGITUDE.doubleValue()))
.andExpect(jsonPath("$.cp").value(DEFAULT_CP.toString()));
}

@Test
Expand Down Expand Up @@ -336,7 +361,8 @@ public void updateLocation() throws Exception {
.stair(UPDATED_STAIR)
.urlgmaps(UPDATED_URLGMAPS)
.latitude(UPDATED_LATITUDE)
.longitude(UPDATED_LONGITUDE);
.longitude(UPDATED_LONGITUDE)
.cp(UPDATED_CP);

restLocationMockMvc.perform(put("/api/locations")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
Expand All @@ -360,6 +386,7 @@ public void updateLocation() throws Exception {
assertThat(testLocation.getUrlgmaps()).isEqualTo(UPDATED_URLGMAPS);
assertThat(testLocation.getLatitude()).isEqualTo(UPDATED_LATITUDE);
assertThat(testLocation.getLongitude()).isEqualTo(UPDATED_LONGITUDE);
assertThat(testLocation.getCp()).isEqualTo(UPDATED_CP);
}

@Test
Expand Down

0 comments on commit 6fa6b7e

Please sign in to comment.