feature/army-specific-points #3

Merged
mitch merged 2 commits from feature/army-specific-points into master 2021-08-11 11:31:29 +00:00
10 changed files with 151 additions and 10 deletions
Showing only changes of commit 884446e031 - Show all commits

View File

@ -1,12 +1,9 @@
package com.warhammer.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@ -38,9 +35,15 @@ public class Army implements Serializable {
@Column(name = "army_power_level")
private Long armyPowerLevel;
@Column(name = "army_race")
private String armyRace;
@Column(name = "army_points")
private Long armyPoints;
@Column(name = "codex_specific_points")
private Long codexSpecificPoints;
@Column(name = "army_points_or_pl")
private Boolean armyPointsOrPL;
@ -227,6 +230,22 @@ public class Army implements Serializable {
this.battlesWon = battlesWon;
}
public Long getCodexSpecificPoints() {
return codexSpecificPoints;
}
public void setCodexSpecificPoints(Long codexSpecificPoints) {
this.codexSpecificPoints = codexSpecificPoints;
}
public String getArmyRace() {
return armyRace;
}
public void setArmyRace(String armyRace) {
this.armyRace = armyRace;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -251,10 +270,12 @@ public class Army implements Serializable {
", armyDescription='" + getArmyDescription() + "'" +
", armyName='" + getArmyName() + "'" +
", armyFaction='" + getArmyFaction() + "'" +
", armyRace='" + getArmyRace() + "'" +
", armyPowerLevel=" + getArmyPowerLevel() +
", armyPoints=" + getArmyPoints() +
", armyPointsOrPL='" + isArmyPointsOrPL() + "'" +
", requisition=" + getRequisition() +
", armyCodexSpecificPoints=" + getCodexSpecificPoints() +
", battleTally=" + getBattleTally() +
", battlesWon=" + getBattlesWon() +
"}";

View File

@ -0,0 +1,52 @@
package com.warhammer.enums;
import java.util.Arrays;
import java.util.List;
public enum ArmyRaces {
ADEPTUS_ASTARTES("Space Marines", Arrays.asList("".split(","))),
GREY_KNIGHTS("Grey Knights", Arrays.asList("True Name Points".split(","))),
ADEPTAS_SORORITAS("Sisters of Battle", Arrays.asList("Saint Points, Martyr Points".split(","))),
ADEPTUS_CUSTODES("Custodians", Arrays.asList("".split(","))),
ADEPTUS_MECHANICUS("AdMech", Arrays.asList("Archeotech Parts".split(","))),
ASTRA_MILITARUM("Imperial Guard", Arrays.asList("".split(","))),
IMPERIAL_KNIGHTS("Imperial Knights", Arrays.asList("".split(","))),
CHAOS_DAEMONS("Daemons", Arrays.asList("".split(","))),
CHAOS_KNIGHTS("Chaos Knights", Arrays.asList("".split(","))),
CHAOS_SPACE_MARINES("Chaos Space Marines", Arrays.asList("".split(","))),
DEATH_GUARD("Death Guard", Arrays.asList("Virulence Points".split(","))),
THOUSAND_SONS("Thousand Sons", Arrays.asList("".split(","))),
CRAFTWORLDS("Eldaar", Arrays.asList("".split(","))),
DRUKHARI("Dark Eldaar", Arrays.asList("".split(","))),
YNNARI("Ynnari", Arrays.asList("".split(","))),
HARLEQUINS("Harlequins", Arrays.asList("".split(","))),
GENESTEALERS("Genestealers", Arrays.asList("".split(","))),
NECRONS("Necons", Arrays.asList("".split(","))),
ORKS("Orks", Arrays.asList("".split(","))),
TAU("Tau", Arrays.asList("".split(","))),
TYRANIDS("Tyranids", Arrays.asList("".split(",")));
private String armyCommonName;
private List<String> armyCodexSpecificPointName;
ArmyRaces(String armyCommonName, List<String> armyCodexSpecificPointName) {
this.armyCommonName = armyCommonName;
this.armyCodexSpecificPointName = armyCodexSpecificPointName;
}
public String getArmyCommonName() {
return armyCommonName;
}
public List<String> getArmyCodexSpecificPointName() {
return armyCodexSpecificPointName;
}
@Override
public String toString() {
return "ArmyRaces{" +
"armyCommonName='" + armyCommonName + '\'' +
", armyCodexSpecificPointName=" + armyCodexSpecificPointName +
'}';
}
}

View File

@ -3,19 +3,16 @@ package com.warhammer.web.rest;
import com.warhammer.domain.UnitArmy;
import com.warhammer.security.SecurityUtils;
import com.warhammer.service.ArmyService;
import com.warhammer.web.rest.errors.BadRequestAlertException;
import com.warhammer.service.dto.ArmyDTO;
import com.warhammer.web.rest.errors.BadRequestAlertException;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.checkerframework.checker.nullness.Opt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.swing.text.html.Option;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="autoIncrement" value="true"/>
<!--
Update the entity UnitArmy.
to remove entity UnitBase
-->
<changeSet id="20210808083300_add_codex_points-1" author="mitch" runOnChange="true">
<addColumn tableName="army">
<column name="codex_specific_points" type="bigint">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<property name="autoIncrement" value="true"/>
<!--
Update the entity UnitArmy.
to remove entity UnitBase
-->
<changeSet id="20210808083300_add_army_race-1" author="mitch" runOnChange="true">
<addColumn tableName="army">
<column name="army_race" type="varchar(255)">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

View File

@ -21,6 +21,8 @@
<include file="config/liquibase/changelog/20200727033716_added_entity_constraints_Army.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20200727033816_added_entity_constraints_UnitArmy.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20200823170000_merge_unit_army_and_base.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20210808083300_add_codex_points.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20210808130500_add_army_race.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
<!-- jhipster-needle-liquibase-add-incremental-changelog - JHipster will add incremental liquibase changelogs here -->
</databaseChangeLog>

View File

@ -29,6 +29,7 @@ export class ArmyUpdateComponent implements OnInit {
armyPoints: [],
armyPointsOrPL: [],
requisition: [],
armyCodexSpecificPoints: [],
battleTally: [],
battlesWon: [],
ownerId: [null, Validators.required],
@ -61,6 +62,7 @@ export class ArmyUpdateComponent implements OnInit {
armyPoints: army.armyPoints,
armyPointsOrPL: army.armyPointsOrPL,
requisition: army.requisition,
armyCodexSpecificPoints: army.armyCodexSpecificPoints,
battleTally: army.battleTally,
battlesWon: army.battlesWon,
ownerId: army.ownerId,
@ -104,10 +106,12 @@ export class ArmyUpdateComponent implements OnInit {
armyDescription: this.editForm.get(['armyDescription'])!.value,
armyName: this.editForm.get(['armyName'])!.value,
armyFaction: this.editForm.get(['armyFaction'])!.value,
armyRace: this.editForm.get(['armyRace'])!.value,
armyPowerLevel: this.editForm.get(['armyPowerLevel'])!.value,
armyPoints: this.editForm.get(['armyPoints'])!.value,
armyPointsOrPL: this.editForm.get(['armyPointsOrPL'])!.value,
requisition: this.editForm.get(['requisition'])!.value,
armyCodexSpecificPoints: this.editForm.get(['armyCodexSpecificPoints'])!.value,
battleTally: this.editForm.get(['battleTally'])!.value,
battlesWon: this.editForm.get(['battlesWon'])!.value,
ownerId: this.editForm.get(['ownerId'])!.value,

View File

@ -1,4 +1,4 @@
<div class="someMoreStuff" *ngFor="let unitLocal of units">
<div class="someMoreStuff" *ngFor="let unitLocal of localUnits">
<div class="unit">
<div class="row">
<div class="col-md-3">

View File

@ -16,10 +16,12 @@ export class ForceComponent implements OnInit {
public forceList: number[];
Iunits?: IUnitArmy[];
units?: UnitArmy[] | null;
localUnits: IUnitArmy[] | [];
constructor(protected dataUtils: JhiDataUtils, protected activatedRoute: ActivatedRoute, protected unitArmyService: UnitArmyService) {
const localStorageList = localStorage.getItem('forceAddedListStored');
this.forceList = localStorageList ? JSON.parse(localStorageList) : [];
this.localUnits = [];
}
ngOnInit(): void {
@ -28,7 +30,22 @@ export class ForceComponent implements OnInit {
loadAll(): void {
for (let lookupUnitId of this.forceList) {
this.unitArmyService.query(lookupUnitId).subscribe((res: HttpResponse<UnitArmy[]>) => (this.units = res.body));
// @ts-ignore
this.unitArmyService.find(lookupUnitId).subscribe((res: HttpResponse<IUnitArmy>) => (this.localUnits?.push(res.body)));
// this.unitArmyService.query(lookupUnitId).subscribe((res: HttpResponse<UnitArmy[]>) => (this.units = res.body));
// console.log(this.units.))
// console.log(lookupUnitId)
// console.log(this.units)
// this.unitArmyService.query(lookupUnitId).subscribe((res: HttpResponse<UnitArmy[]>) => (console.log(res.body)));
//this.units is full list of units
// @ts-ignore
// for (const _unit of this.units) {
// console.log(_unit.id)
// console.log(lookupUnitId)
// if (_unit.id === lookupUnitId) {
// this.localUnits.push(_unit);
// }
// }
lookupUnitId = 1;
}
}

View File

@ -5,10 +5,12 @@ export interface IArmy {
armyDescription?: any;
armyName?: string;
armyFaction?: string;
armyRace?: string;
armyPowerLevel?: number;
armyPoints?: number;
armyPointsOrPL?: boolean;
requisition?: number;
armyCodexSpecificPoints?: number;
battleTally?: number;
battlesWon?: number;
ownerLogin?: string;
@ -22,12 +24,14 @@ export class Army implements IArmy {
public armyDescription?: any,
public armyName?: string,
public armyFaction?: string,
public armyRace?: string,
public armyPowerLevel?: number,
public armyPoints?: number,
public armyPointsOrPL?: boolean,
public ownerId?: number,
public ownerLogin?: string,
public requisition?: number,
public armyCodexSpecificPoints?: number,
public battleTally?: number,
public battlesWon?: number,
public units?: IUnitArmy[]