Oui oui baguette
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type {TimeStampDto} from "@/dto/TimeStampDto.ts";
|
||||
|
||||
export class ParticipantDto {
|
||||
export class AttendeeDto {
|
||||
|
||||
public name: string;
|
||||
public dates: TimeStampDto[];
|
||||
@@ -1,17 +1,17 @@
|
||||
import type {Participant} from "@/models/Participant.ts";
|
||||
import type {Attendee} from "@/models/Attendee.ts";
|
||||
import type {TimeStamp} from "@/models/TimeStamp.ts";
|
||||
import type {ParticipantDto} from "@/dto/ParticipantDto.ts";
|
||||
import type {AttendeeDto} from "@/dto/AttendeeDto.ts";
|
||||
|
||||
export class EventDto {
|
||||
|
||||
public name: string;
|
||||
public token: string;
|
||||
public participants: ParticipantDto[];
|
||||
public attendees: AttendeeDto[];
|
||||
|
||||
public constructor(name: string, token: string, participants: ParticipantDto[]) {
|
||||
public constructor(name: string, token: string, attendees: AttendeeDto[]) {
|
||||
this.name = name;
|
||||
this.token = token;
|
||||
this.participants = participants;
|
||||
this.attendees = attendees;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type {TimeStamp, TimeStampState} from "@/models/TimeStamp.ts";
|
||||
|
||||
export class Participant {
|
||||
export class Attendee {
|
||||
|
||||
private name: string;
|
||||
private dates: TimeStamp[];
|
||||
@@ -19,7 +19,7 @@ export class Participant {
|
||||
}
|
||||
}
|
||||
|
||||
export interface ParticipantState {
|
||||
export interface AttendeeState {
|
||||
name : String
|
||||
dates : TimeStampState[]
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
import type {Participant, ParticipantState} from "@/models/Participant.ts";
|
||||
import type {TimeStampState} from "@/models/TimeStamp.ts";
|
||||
import type {Attendee, AttendeeState} from "@/models/Attendee.ts";
|
||||
|
||||
export class Event {
|
||||
|
||||
private name: string;
|
||||
private token: string;
|
||||
private participants: Participant[];
|
||||
private attendees: Attendee[];
|
||||
|
||||
public constructor(name: string, token: string, participants: Participant[]) {
|
||||
public constructor(name: string, token: string, attendees: Attendee[]) {
|
||||
this.name = name;
|
||||
this.token = token;
|
||||
this.participants = participants;
|
||||
this.attendees = attendees;
|
||||
}
|
||||
|
||||
public getName() : string {
|
||||
@@ -21,8 +20,8 @@ export class Event {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public getParticipants() : Participant[] {
|
||||
return this.participants;
|
||||
public getAttendees() : Attendee[] {
|
||||
return this.attendees;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +29,6 @@ export class Event {
|
||||
export interface EventState {
|
||||
name : String
|
||||
token : String
|
||||
participants: ParticipantState[];
|
||||
attendees: AttendeeState[];
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export class EventRequests {
|
||||
let url = this.formatUrl([this.baseUrl, this.endpoints.EVENTS, token]);
|
||||
return fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(data => new EventDto(data.name, data.token, data.participants))
|
||||
.then(data => new EventDto(data.name, data.token, data.attendees))
|
||||
.catch(error => console.error(error));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import {defineStore} from 'pinia'
|
||||
import {EventRequests} from "@/requests/EventRequests.ts";
|
||||
import type {EventDto} from "@/dto/EventDto.ts";
|
||||
import type {EventState} from "@/models/Event.ts";
|
||||
import type {ParticipantDto} from "@/dto/ParticipantDto.ts";
|
||||
import type {ParticipantState} from "@/models/Participant.ts";
|
||||
import type {AttendeeDto} from "@/dto/AttendeeDto.ts";
|
||||
import type {AttendeeState} from "@/models/Attendee.ts";
|
||||
import type {TimeStamp, TimeStampState} from "@/models/TimeStamp.ts";
|
||||
import type {TimeStampDto} from "@/dto/TimeStampDto.ts";
|
||||
|
||||
@@ -15,7 +15,7 @@ export const eventStore = defineStore('eventStore', {
|
||||
event : {
|
||||
name: "",
|
||||
token: "",
|
||||
participants: [] as ParticipantState[]
|
||||
attendees: [] as AttendeeState[]
|
||||
}};
|
||||
},
|
||||
getters : {
|
||||
@@ -30,7 +30,7 @@ export const eventStore = defineStore('eventStore', {
|
||||
this.event.name = data.name;
|
||||
this.event.token = data.token;
|
||||
|
||||
this.event.participants = data.participants.map((p: ParticipantDto) => ({
|
||||
this.event.attendees = data.attendees.map((p: AttendeeDto) => ({
|
||||
name: p.name,
|
||||
dates: p.dates.map((date: TimeStampDto) => ({
|
||||
value: date.timestamp
|
||||
|
||||
@@ -16,16 +16,25 @@ function extractToken() : string {
|
||||
return Array.isArray(route.params.token) ? route.params.token[0] : route.params.token;
|
||||
}
|
||||
|
||||
function attendeesByDates(){
|
||||
|
||||
}
|
||||
|
||||
function formatDate(timestamp : number) : String{
|
||||
let date = DateHelper.toDate(timestamp)
|
||||
return `${date.getDate()}-${date.getMonth() + 1}-${date.getFullYear()}`;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Name : {{ store.event.name }}
|
||||
Participants :
|
||||
<div v-for="(p) in store.event.participants" >
|
||||
Name : {{ store.event.name }} <br>
|
||||
attendees :
|
||||
<div v-for="(p) in store.event.attendees" >
|
||||
{{ p.name }}
|
||||
<div v-for="(d) in p.dates">
|
||||
{{ DateHelper.toDate(d.value) }}
|
||||
{{ formatDate(d.value) }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user