Merge branch 'feature/edit-event' into 'master'

Prepare front to edit events

See merge request framasoft/mobilizon!174
This commit is contained in:
Thomas Citharel
2019-09-02 15:26:39 +02:00
10 changed files with 212 additions and 144 deletions

View File

@@ -1,7 +1,7 @@
import { Actor, IActor } from './actor';
import { IAddress } from '@/types/address.model';
import { ITag } from '@/types/tag.model';
import { IAbstractPicture, IPicture } from '@/types/picture.model';
import { IPicture } from '@/types/picture.model';
export enum EventStatus {
TENTATIVE,
@@ -53,10 +53,10 @@ export interface IEvent {
title: string;
slug: string;
description: string;
category: Category|null;
category: Category | null;
beginsOn: Date;
endsOn: Date;
endsOn: Date | null;
publishAt: Date;
status: EventStatus;
@@ -64,7 +64,7 @@ export interface IEvent {
joinOptions: EventJoinOptions;
picture: IAbstractPicture|null;
picture: IPicture | null;
organizerActor: IActor;
attributedTo: IActor;
@@ -79,27 +79,76 @@ export interface IEvent {
tags: ITag[];
}
export class EventModel implements IEvent {
beginsOn: Date = new Date();
category: Category = Category.MEETING;
slug: string = '';
description: string = '';
endsOn: Date = new Date();
joinOptions: EventJoinOptions = EventJoinOptions.FREE;
local: boolean = true;
id?: number;
beginsOn = new Date();
endsOn: Date | null = new Date();
title = '';
url = '';
uuid = '';
slug = '';
description = '';
local = true;
onlineAddress: string | undefined = '';
phoneAddress: string | undefined = '';
physicalAddress?: IAddress;
picture: IPicture | null = null;
visibility = EventVisibility.PUBLIC;
category: Category | null = Category.MEETING;
joinOptions = EventJoinOptions.FREE;
status = EventStatus.CONFIRMED;
publishAt = new Date();
participants: IParticipant[] = [];
publishAt: Date = new Date();
status: EventStatus = EventStatus.CONFIRMED;
title: string = '';
url: string = '';
uuid: string = '';
visibility: EventVisibility = EventVisibility.PUBLIC;
attributedTo: IActor = new Actor();
organizerActor: IActor = new Actor();
relatedEvents: IEvent[] = [];
onlineAddress: string = '';
phoneAddress: string = '';
picture: IAbstractPicture|null = null;
attributedTo = new Actor();
organizerActor = new Actor();
tags: ITag[] = [];
constructor(hash?: IEvent) {
if (!hash) return;
this.id = hash.id;
this.uuid = hash.uuid;
this.url = hash.url;
this.local = hash.local;
this.title = hash.title;
this.slug = hash.slug;
this.description = hash.description;
this.category = hash.category;
this.beginsOn = new Date(hash.beginsOn);
if (hash.endsOn) this.endsOn = new Date(hash.endsOn);
this.publishAt = new Date(hash.publishAt);
this.status = hash.status;
this.visibility = hash.visibility;
this.joinOptions = hash.joinOptions;
this.picture = hash.picture;
this.organizerActor = new Actor(hash.organizerActor);
this.attributedTo = new Actor(hash.attributedTo);
this.participants = hash.participants;
this.relatedEvents = hash.relatedEvents;
this.onlineAddress = hash.onlineAddress;
this.phoneAddress = hash.phoneAddress;
this.physicalAddress = hash.physicalAddress;
this.tags = hash.tags;
}
}

View File

@@ -1,16 +1,11 @@
export interface IAbstractPicture {
name;
alt;
}
export interface IPicture {
url;
name;
alt;
url: string;
name: string;
alt: string;
}
export interface IPictureUpload {
file: File;
name: String;
alt: String|null;
name: string;
alt: string | null;
}