Work around Addresses to bring them properly through GraphQL

Got caught with https://github.com/absinthe-graphql/absinthe/issues/601
at some point, that's why fields are renamed

Fix tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-03-22 15:51:23 +01:00
parent 53458b16a2
commit 0c8d2f7e00
25 changed files with 200 additions and 145 deletions

View File

@@ -29,6 +29,16 @@ export const FETCH_EVENT = gql`
category,
# online_address,
# phone_address,
physicalAddress {
description,
floor,
street,
locality,
postal_code,
region,
country,
geom
}
organizerActor {
avatarUrl,
preferredUsername,
@@ -64,6 +74,9 @@ export const FETCH_EVENTS = gql`
publishAt,
# online_address,
# phone_address,
physicalAddress {
description
}
organizerActor {
avatarUrl,
preferredUsername,

View File

@@ -0,0 +1,13 @@
export interface IAddress {
description: string;
floor: string;
street: string;
locality: string;
postal_code: string;
region: string;
country: string;
geom: {
lat: number;
lon: number;
}
}

View File

@@ -1,4 +1,5 @@
import { Actor, IActor } from './actor.model';
import {IAddress} from "@/types/address.model";
export enum EventStatus {
TENTATIVE,
@@ -67,8 +68,9 @@ export interface IEvent {
attributedTo: IActor;
participants: IParticipant[];
// online_address: Address;
// phone_address: string;
onlineAddress?: string;
phoneAddress?: string;
physicalAddress?: IAddress;
}
@@ -90,4 +92,6 @@ export class EventModel implements IEvent {
visibility: EventVisibility = EventVisibility.PUBLIC;
attributedTo: IActor = new Actor();
organizerActor: IActor = new Actor();
onlineAddress: string = '';
phoneAddress: string = '';
}

View File

@@ -46,6 +46,15 @@
<div>
<span>{{ event.beginsOn | formatDate }} - {{ event.endsOn | formatDate }}</span>
</div>
<div class="address" v-if="event.physicalAddress">
<h3 class="subtitle">Adresse</h3>
<address>
<span>{{ event.physicalAddress.description }}</span><br>
<span>{{ event.physicalAddress.floor }} {{ event.physicalAddress.street }}</span><br>
<span>{{ event.physicalAddress.postal_code }} {{ event.physicalAddress.locality }}</span><br>
<span>{{ event.physicalAddress.region }} {{ event.physicalAddress.country }}</span>
</address>
</div>
<p v-if="actorIsOrganizer()">
<translate>You are an organizer.</translate>
</p>

View File

@@ -76,11 +76,11 @@ export default class CreateGroup extends Vue {
latitude: addressData.latitude,
longitude: addressData.longitude,
},
addressCountry: addressData.country,
addressLocality: addressData.city,
addressRegion: addressData.administrative_area_level_1,
postalCode: addressData.postal_code,
streetAddress: `${addressData.street_number} ${addressData.route}`,
country: addressData.country,
locality: addressData.city,
region: addressData.administrative_area_level_1,
postal_code: addressData.postal_code,
street: `${addressData.street_number} ${addressData.route}`,
};
}
}