Commit 0562ac3a by Tuukka Kivilahti

commit before mergin onja's changes

1 parent 4f6f5ef2
package-lock=false
......@@ -44,7 +44,7 @@
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.7.0",
"@angular-devkit/build-angular": "~0.7.2",
"@angular/cdk": "^6.4.2",
"@angular/cli": "6.1.2",
"@angular/compiler-cli": "6.1.1",
......
/**
* Created by tuukka on 04/02/17.
*/
import gql from "graphql-tag";
export class VipProductDelivery {
/*
public Integer id;
public Integer delivererId;
public BigDecimal quantity;
public Date deliveryTime;
public String notes;
*/
static fragments = gql`
fragment vipProductDeliveryPrimitives on VipProductDelivery {
deliverytime
id
notes
quantity
}
`;
id: number;
delivererId: number;
......
import {VipProductDelivery} from './vip-product-delivery.model';
import gql from "graphql-tag";
/**
* Created by tuukka on 04/02/17.
*/
......@@ -7,17 +8,14 @@ import {VipProductDelivery} from './vip-product-delivery.model';
export class VipProduct {
/*
public Integer id;
public String name;
public Integer productId;
public String notes;
public BigDecimal quantity;
public BigDecimal delivered;
public List<VipProductDeliveryPojo> deliveries = new ArrayList<>();
*/
static fragments = gql`
fragment vipProductPrimitives on VipProduct {
id
name
notes
quantity
}
`;
id: number;
name: string;
......
import {VipProduct} from './vip-product.model';
import {User} from '../../../shared/models/user.model';
import gql from "graphql-tag";
import {VipProductDelivery} from "./vip-product-delivery.model";
/**
* Created by tuukka on 04/02/17.
*/
......@@ -8,17 +10,14 @@ import {User} from '../../../shared/models/user.model';
export class Vip {
/*
public Integer id;
public String description;
public String shortdescr;
public Date created;
public Integer eventuserId;
public Integer creatorId;
public Integer hostId;
public List<VipProductPojo> products = new ArrayList<>();
*/
static fragments = gql`
fragment vipPrimitives on Vip {
created
description
id
shortdescr
}
`;
id: number;
description: string;
......@@ -35,3 +34,9 @@ export class Vip {
}
}
export const VipFragmentsCombined = gql`
${Vip.fragments}
${VipProduct.fragments}
${VipProductDelivery.fragments}
`;
import {Injectable} from '@angular/core';
import {Vip} from './models/vip.model';
import {Vip, VipFragmentsCombined} from './models/vip.model';
import {User} from '../../shared/models/user.model';
import {UserService} from '../../shared/services/user.service';
import {Observable} from 'rxjs/Observable';
......@@ -9,11 +9,46 @@ import 'rxjs/add/observable/forkJoin';
import 'rxjs/add/operator/first';
import {HttpClient} from '@angular/common/http';
import {MOYA_REST_URL} from "../../shared/config/moya.config";
import gql from 'graphql-tag';
import {EventUser} from "../../shared/models/event-user.model";
import {Apollo} from "apollo-angular";
import "rxjs-compat/add/operator/map";
export const Q_VIPS_N_DATA = gql`
query Vips() {
vips {
...vipPrimitives
products {
...vipProductPrimitives
deliveries {
...vipProductDeliveryPrimitives
}
}
creator {
...eventUserPrimitives
user {
...userPrimitives
}
}
}
}
${VipFragmentsCombined}
${EventUser.fragments}
${User.fragments}
`;
@Injectable()
export class ViplistService {
constructor(private http: HttpClient, private userService: UserService) {
constructor(private apollo: Apollo, private http: HttpClient, private userService: UserService) {
}
......@@ -22,15 +57,19 @@ export class ViplistService {
* get vips
* @param searchString: searchString, skip to return all vips
*/
public get(searchString?: string): Observable<Array<Vip>> {
public get(): Observable<Array<Vip>> {
return this.apollo.watchQuery<Array<Vip>>({query: Q_VIPS_N_DATA}).valueChanges.map(x => x.data);
//Vip .map(x => x as Vip);
if (!searchString) {
return this.http.get(MOYA_REST_URL + 'v3/vip/all')
.switchMap(res => Observable.forkJoin(...(res as Array<any>).map(apiRow => this.hostPopulator(apiRow))));
}
return this.http.get(MOYA_REST_URL + 'v3/vip/search/' + searchString)
.switchMap(v => Observable.forkJoin(...(v as Array<any>).map(x => this.hostPopulator(x))));
}
......
import {User} from "./user.model";
import gql from "graphql-tag";
export enum UserGender {
MALE,
FEMALE,
UNSPECIFIED
}
export class EventUser {
static fragments = gql`
fragment eventUserPrimitives on EventUser {
id
eventusercreated
}
`;
id: number;
eventusercreated: Date;
user: User;
constructor() { }
}
......@@ -4,6 +4,8 @@
// vim magic: %s/^\s*\w\+\s\+\(\w\+\)\s\+\(\w\+\)\s*.*;$/ \2: \L\1;/
import gql from "graphql-tag";
export enum UserGender {
MALE,
FEMALE,
......@@ -12,10 +14,33 @@ export enum UserGender {
export class User {
static fragments = gql`
fragment userPrimitives on User {
address
allergiesFreetext
birthday
email
firstnames
gender
id:
lastname
login
nick
phone
town
shirtSize
town
zip
}
`;
nick: string;
login: string;
eventuserId: number;
userId: number;
id: number;
firstname: string;
lastname: string;
password: string;
......@@ -23,12 +48,12 @@ export class User {
birthday: Date;
gender: UserGender;
phoneNumber: string;
phone: string;
email: string;
streetAddress: string;
zipCode: string;
postOffice: string;
zip: string;
town: string;
constructor() { }
......
......@@ -12,10 +12,11 @@
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
"es2018",
"dom",
"esnext.asynciterable"
],
"module": "es2015",
"baseUrl": "./"
}
}
\ No newline at end of file
}
......@@ -626,6 +626,13 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE compo_voting_roles ADD CONSTRAINT FK_compo_voting_roles_scheme_id FOREIGN KEY (scheme_id) REFERENCES compo_voting_schemes (id)",
"ALTER TABLE compo_voting_roles ADD CONSTRAINT FK_compo_voting_roles_role_id FOREIGN KEY (role_id) REFERENCES roles (id)",
});
dbUpdates.add(new String[]{
"ALTER TABLE users DROP COLUMN postal_town;"
});
}
......
......@@ -96,9 +96,6 @@ public class User extends GenericEntity implements IUser {
@Column(name = "zip")
private String zip = "";
@Column(name = "postal_town")
private String postalTown = "";
@Column(name = "town")
private String town = "";
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!