Migrate to Vue 3 and Vite
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -6,7 +6,7 @@ export interface IActor {
|
||||
url: string;
|
||||
name: string;
|
||||
domain: string | null;
|
||||
mediaSize: number;
|
||||
mediaSize?: number;
|
||||
summary: string;
|
||||
preferredUsername: string;
|
||||
suspended: boolean;
|
||||
@@ -56,7 +56,10 @@ export class Actor implements IActor {
|
||||
}
|
||||
}
|
||||
|
||||
export function usernameWithDomain(actor: IActor, force = false): string {
|
||||
export function usernameWithDomain(
|
||||
actor: IActor | undefined,
|
||||
force = false
|
||||
): string {
|
||||
if (!actor) return "";
|
||||
if (actor?.domain) {
|
||||
return `${actor.preferredUsername}@${actor.domain}`;
|
||||
@@ -67,7 +70,7 @@ export function usernameWithDomain(actor: IActor, force = false): string {
|
||||
return actor.preferredUsername;
|
||||
}
|
||||
|
||||
export function displayName(actor: IActor): string {
|
||||
export function displayName(actor: IActor | undefined): string {
|
||||
return actor && actor.name != null && actor.name !== ""
|
||||
? actor.name
|
||||
: usernameWithDomain(actor);
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ActorType, GroupVisibility, Openness } from "../enums";
|
||||
import type { IMember } from "./member.model";
|
||||
import type { ITodoList } from "../todolist";
|
||||
import { IActivity } from "../activity.model";
|
||||
import { IFollower } from "./follower.model";
|
||||
|
||||
export interface IGroup extends IActor {
|
||||
members: Paginate<IMember>;
|
||||
@@ -24,10 +25,12 @@ export interface IGroup extends IActor {
|
||||
visibility: GroupVisibility;
|
||||
manuallyApprovesFollowers: boolean;
|
||||
activity: Paginate<IActivity>;
|
||||
followers: Paginate<IFollower>;
|
||||
}
|
||||
|
||||
export class Group extends Actor implements IGroup {
|
||||
members: Paginate<IMember> = { elements: [], total: 0 };
|
||||
followers: Paginate<IFollower> = { elements: [], total: 0 };
|
||||
|
||||
resources: Paginate<IResource> = { elements: [], total: 0 };
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@ import { IFollower } from "./follower.model";
|
||||
|
||||
export interface IPerson extends IActor {
|
||||
feedTokens: IFeedToken[];
|
||||
goingToEvents: IEvent[];
|
||||
participations: Paginate<IParticipant>;
|
||||
memberships: Paginate<IMember>;
|
||||
follows: Paginate<IFollower>;
|
||||
goingToEvents?: IEvent[];
|
||||
participations?: Paginate<IParticipant>;
|
||||
memberships?: Paginate<IMember>;
|
||||
follows?: Paginate<IFollower>;
|
||||
user?: ICurrentUser;
|
||||
organizedEvents?: Paginate<IEvent>;
|
||||
}
|
||||
|
||||
export class Person extends Actor implements IPerson {
|
||||
@@ -26,6 +27,8 @@ export class Person extends Actor implements IPerson {
|
||||
|
||||
memberships!: Paginate<IMember>;
|
||||
|
||||
organizedEvents!: Paginate<IEvent>;
|
||||
|
||||
user!: ICurrentUser;
|
||||
|
||||
constructor(hash: IPerson | Record<string, unknown> = {}) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { poiIcons } from "@/utils/poiIcons";
|
||||
import type { IPOIIcon } from "@/utils/poiIcons";
|
||||
import { PictureInformation } from "./picture";
|
||||
|
||||
export interface IAddress {
|
||||
id?: string;
|
||||
@@ -14,6 +15,8 @@ export interface IAddress {
|
||||
url?: string;
|
||||
originId?: string;
|
||||
timezone?: string;
|
||||
pictureInfo?: PictureInformation;
|
||||
poiInfos?: IPoiInfo;
|
||||
}
|
||||
|
||||
export interface IPoiInfo {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { IEvent } from "@/types/event.model";
|
||||
import type { IGroup } from "./actor";
|
||||
import { InstanceTermsType } from "./enums";
|
||||
import { InstancePrivacyType, InstanceTermsType } from "./enums";
|
||||
|
||||
export interface IDashboard {
|
||||
lastPublicEventPublished: IEvent;
|
||||
@@ -29,7 +29,7 @@ export interface IAdminSettings {
|
||||
instanceTermsType: InstanceTermsType;
|
||||
instanceTermsUrl: string | null;
|
||||
instancePrivacyPolicy: string;
|
||||
instancePrivacyPolicyType: InstanceTermsType;
|
||||
instancePrivacyPolicyType: InstancePrivacyType;
|
||||
instancePrivacyPolicyUrl: string | null;
|
||||
instanceRules: string;
|
||||
registrationsOpen: boolean;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Actor } from "@/types/actor";
|
||||
import type { IActor } from "@/types/actor";
|
||||
import { IPerson, Person } from "@/types/actor";
|
||||
import type { IEvent } from "@/types/event.model";
|
||||
import { EventModel } from "@/types/event.model";
|
||||
|
||||
@@ -9,21 +8,22 @@ export interface IComment {
|
||||
url?: string;
|
||||
text: string;
|
||||
local: boolean;
|
||||
actor: IActor | null;
|
||||
actor: IPerson | null;
|
||||
inReplyToComment?: IComment;
|
||||
originComment?: IComment;
|
||||
replies: IComment[];
|
||||
event?: IEvent;
|
||||
updatedAt?: Date | string;
|
||||
deletedAt?: Date | string;
|
||||
updatedAt?: string;
|
||||
deletedAt?: string;
|
||||
totalReplies: number;
|
||||
insertedAt?: Date | string;
|
||||
publishedAt?: Date | string;
|
||||
insertedAt?: string;
|
||||
publishedAt?: string;
|
||||
isAnnouncement: boolean;
|
||||
language?: string;
|
||||
}
|
||||
|
||||
export class CommentModel implements IComment {
|
||||
actor: IActor = new Actor();
|
||||
actor: IPerson = new Person();
|
||||
|
||||
id?: string;
|
||||
|
||||
@@ -43,11 +43,11 @@ export class CommentModel implements IComment {
|
||||
|
||||
event?: IEvent = undefined;
|
||||
|
||||
updatedAt?: Date | string = undefined;
|
||||
updatedAt?: string = undefined;
|
||||
|
||||
deletedAt?: Date | string = undefined;
|
||||
deletedAt?: string = undefined;
|
||||
|
||||
insertedAt?: Date | string = undefined;
|
||||
insertedAt?: string = undefined;
|
||||
|
||||
totalReplies = 0;
|
||||
|
||||
@@ -62,12 +62,12 @@ export class CommentModel implements IComment {
|
||||
this.text = hash.text;
|
||||
this.inReplyToComment = hash.inReplyToComment;
|
||||
this.originComment = hash.originComment;
|
||||
this.actor = hash.actor ? new Actor(hash.actor) : new Actor();
|
||||
this.actor = hash.actor ? new Person(hash.actor) : new Person();
|
||||
this.event = new EventModel(hash.event);
|
||||
this.replies = hash.replies;
|
||||
this.updatedAt = new Date(hash.updatedAt as string);
|
||||
this.updatedAt = new Date(hash.updatedAt as string).toISOString();
|
||||
this.deletedAt = hash.deletedAt;
|
||||
this.insertedAt = new Date(hash.insertedAt as string);
|
||||
this.insertedAt = new Date(hash.insertedAt as string).toISOString();
|
||||
this.totalReplies = hash.totalReplies;
|
||||
this.isAnnouncement = hash.isAnnouncement;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { IProvider } from "./resource";
|
||||
|
||||
export interface IOAuthProvider {
|
||||
id: string;
|
||||
label: string;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
export interface IKeyValueConfig {
|
||||
@@ -18,6 +18,19 @@ export interface IAnalyticsConfig {
|
||||
configuration: IKeyValueConfig[];
|
||||
}
|
||||
|
||||
export interface IAnonymousParticipationConfig {
|
||||
allowed: boolean;
|
||||
validation: {
|
||||
email: {
|
||||
enabled: boolean;
|
||||
confirmationRequired: boolean;
|
||||
};
|
||||
captcha: {
|
||||
enabled: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface IConfig {
|
||||
name: string;
|
||||
description: string;
|
||||
@@ -37,18 +50,7 @@ export interface IConfig {
|
||||
// accuracyRadius: number;
|
||||
};
|
||||
anonymous: {
|
||||
participation: {
|
||||
allowed: boolean;
|
||||
validation: {
|
||||
email: {
|
||||
enabled: boolean;
|
||||
confirmationRequired: boolean;
|
||||
};
|
||||
captcha: {
|
||||
enabled: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
participation: IAnonymousParticipationConfig;
|
||||
eventCreation: {
|
||||
allowed: boolean;
|
||||
validation: {
|
||||
|
||||
@@ -4,6 +4,9 @@ import type { Paginate } from "./paginate";
|
||||
import type { IParticipant } from "./participant.model";
|
||||
import { ICurrentUserRole, INotificationPendingEnum } from "./enums";
|
||||
import { IFollowedGroupEvent } from "./followedGroupEvent.model";
|
||||
import { PictureInformation } from "./picture";
|
||||
import { IMember } from "./actor/member.model";
|
||||
import { IFeedToken } from "./feedtoken.model";
|
||||
|
||||
export interface ICurrentUser {
|
||||
id: string;
|
||||
@@ -19,6 +22,12 @@ export interface IUserPreferredLocation {
|
||||
geohash?: string | null;
|
||||
}
|
||||
|
||||
export interface ExtendedIUserPreferredLocation extends IUserPreferredLocation {
|
||||
lat: number | undefined;
|
||||
lon: number | undefined;
|
||||
picture?: PictureInformation;
|
||||
}
|
||||
|
||||
export interface IUserSettings {
|
||||
timezone?: string;
|
||||
notificationOnDay?: boolean;
|
||||
@@ -39,8 +48,8 @@ export interface IActivitySetting {
|
||||
}
|
||||
|
||||
export interface IUser extends ICurrentUser {
|
||||
confirmedAt: Date;
|
||||
confirmationSendAt: Date;
|
||||
confirmedAt: string;
|
||||
confirmationSendAt: string;
|
||||
actors: IPerson[];
|
||||
disabled: boolean;
|
||||
participations: Paginate<IParticipant>;
|
||||
@@ -55,4 +64,6 @@ export interface IUser extends ICurrentUser {
|
||||
lastSignInIp: string;
|
||||
currentSignInIp: string;
|
||||
currentSignInAt: string;
|
||||
memberships: Paginate<IMember>;
|
||||
feedTokens: IFeedToken[];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import { ExecutionResult, GraphQLError } from "graphql";
|
||||
|
||||
export declare class AbsintheGraphQLError extends GraphQLError {
|
||||
field?: string;
|
||||
code?: string;
|
||||
status_code?: number;
|
||||
}
|
||||
export declare type AbsintheGraphQLErrors = ReadonlyArray<AbsintheGraphQLError>;
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ export interface IEventMetadata {
|
||||
export interface IEventMetadataDescription extends IEventMetadata {
|
||||
icon?: string;
|
||||
placeholder?: string;
|
||||
description: string;
|
||||
description?: string;
|
||||
choices?: Record<string, string>;
|
||||
keyType: EventMetadataKeyType;
|
||||
keyType?: EventMetadataKeyType;
|
||||
pattern?: RegExp;
|
||||
label: string;
|
||||
category: EventMetadataCategories;
|
||||
|
||||
@@ -10,14 +10,13 @@ import type { IParticipant } from "./participant.model";
|
||||
import { EventOptions } from "./event-options.model";
|
||||
import type { IEventOptions } from "./event-options.model";
|
||||
import { EventJoinOptions, EventStatus, EventVisibility } from "./enums";
|
||||
import { IEventMetadata } from "./event-metadata";
|
||||
import { IEventMetadata, IEventMetadataDescription } from "./event-metadata";
|
||||
|
||||
export interface IEventCardOptions {
|
||||
hideDate: boolean;
|
||||
loggedPerson: IPerson | boolean;
|
||||
hideDetails: boolean;
|
||||
organizerActor: IActor | null;
|
||||
memberofGroup: boolean;
|
||||
hideDate?: boolean;
|
||||
loggedPerson?: IPerson | boolean;
|
||||
hideDetails?: boolean;
|
||||
organizerActor?: IActor | null;
|
||||
}
|
||||
|
||||
export interface IEventParticipantStats {
|
||||
@@ -65,9 +64,9 @@ export interface IEvent {
|
||||
title: string;
|
||||
slug: string;
|
||||
description: string;
|
||||
beginsOn: Date;
|
||||
endsOn: Date | null;
|
||||
publishAt: Date;
|
||||
beginsOn: string;
|
||||
endsOn: string | null;
|
||||
publishAt: string;
|
||||
status: EventStatus;
|
||||
visibility: EventVisibility;
|
||||
joinOptions: EventJoinOptions;
|
||||
@@ -89,23 +88,23 @@ export interface IEvent {
|
||||
|
||||
tags: ITag[];
|
||||
options: IEventOptions;
|
||||
metadata: IEventMetadata[];
|
||||
metadata: IEventMetadataDescription[];
|
||||
contacts: IActor[];
|
||||
language: string;
|
||||
category: string;
|
||||
|
||||
toEditJSON(): IEventEditJSON;
|
||||
toEditJSON?(): IEventEditJSON;
|
||||
}
|
||||
|
||||
export interface IEditableEvent extends Omit<IEvent, "beginsOn"> {
|
||||
beginsOn: Date | null;
|
||||
beginsOn: string | null;
|
||||
}
|
||||
export class EventModel implements IEvent {
|
||||
id?: string;
|
||||
|
||||
beginsOn = new Date();
|
||||
beginsOn = new Date().toISOString();
|
||||
|
||||
endsOn: Date | null = new Date();
|
||||
endsOn: string | null = new Date().toISOString();
|
||||
|
||||
title = "";
|
||||
|
||||
@@ -135,7 +134,7 @@ export class EventModel implements IEvent {
|
||||
|
||||
draft = true;
|
||||
|
||||
publishAt = new Date();
|
||||
publishAt = new Date().toISOString();
|
||||
|
||||
language = "und";
|
||||
|
||||
@@ -166,7 +165,7 @@ export class EventModel implements IEvent {
|
||||
|
||||
options: IEventOptions = new EventOptions();
|
||||
|
||||
metadata: IEventMetadata[] = [];
|
||||
metadata: IEventMetadataDescription[] = [];
|
||||
|
||||
category = "MEETING";
|
||||
|
||||
@@ -183,15 +182,15 @@ export class EventModel implements IEvent {
|
||||
this.description = hash.description || "";
|
||||
|
||||
if (hash.beginsOn) {
|
||||
this.beginsOn = new Date(hash.beginsOn);
|
||||
this.beginsOn = new Date(hash.beginsOn).toISOString();
|
||||
}
|
||||
if (hash.endsOn) {
|
||||
this.endsOn = new Date(hash.endsOn);
|
||||
this.endsOn = new Date(hash.endsOn).toISOString();
|
||||
} else {
|
||||
this.endsOn = null;
|
||||
}
|
||||
|
||||
this.publishAt = new Date(hash.publishAt);
|
||||
this.publishAt = new Date(hash.publishAt).toISOString();
|
||||
|
||||
this.status = hash.status;
|
||||
this.visibility = hash.visibility;
|
||||
@@ -242,8 +241,8 @@ export function toEditJSON(event: IEditableEvent): IEventEditJSON {
|
||||
id: event.id,
|
||||
title: event.title,
|
||||
description: event.description,
|
||||
beginsOn: event.beginsOn ? event.beginsOn.toISOString() : null,
|
||||
endsOn: event.endsOn ? event.endsOn.toISOString() : null,
|
||||
beginsOn: event.beginsOn ? event.beginsOn.toString() : null,
|
||||
endsOn: event.endsOn ? event.endsOn.toString() : null,
|
||||
status: event.status,
|
||||
category: event.category,
|
||||
visibility: event.visibility,
|
||||
@@ -280,6 +279,10 @@ export function organizer(event: IEvent): IActor | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function organizerAvatarUrl(event: IEvent): string | null {
|
||||
return organizer(event)?.avatar?.url ?? null;
|
||||
}
|
||||
|
||||
export function organizerDisplayName(event: IEvent): string | null {
|
||||
const organizerActor = organizer(event);
|
||||
if (organizerActor) {
|
||||
|
||||
@@ -12,4 +12,5 @@ export interface IInstance {
|
||||
followingsCount: number;
|
||||
reportsCount: number;
|
||||
mediaSize: number;
|
||||
eventCount: number;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ export interface IMediaUpload {
|
||||
alt: string | null;
|
||||
}
|
||||
|
||||
export interface IMediaUploadWrapper {
|
||||
media: IMediaUpload;
|
||||
}
|
||||
|
||||
export interface IMediaMetadata {
|
||||
width?: number;
|
||||
height?: number;
|
||||
|
||||
11
js/src/types/picture.ts
Normal file
11
js/src/types/picture.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface PictureInformation {
|
||||
url: string;
|
||||
author: {
|
||||
name: string;
|
||||
url: string;
|
||||
};
|
||||
source: {
|
||||
name: string;
|
||||
url: string;
|
||||
};
|
||||
}
|
||||
@@ -16,6 +16,8 @@ export interface IPost {
|
||||
visibility: PostVisibility;
|
||||
author?: IActor;
|
||||
attributedTo?: IActor;
|
||||
publishAt?: Date;
|
||||
insertedAt?: Date;
|
||||
publishAt?: string;
|
||||
insertedAt?: string;
|
||||
language?: string;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface IReportNote extends IActionLogObject {
|
||||
id: string;
|
||||
content: string;
|
||||
moderator: IActor;
|
||||
insertedAt: string;
|
||||
}
|
||||
export interface IReport extends IActionLogObject {
|
||||
id: string;
|
||||
@@ -19,8 +20,8 @@ export interface IReport extends IActionLogObject {
|
||||
comments: IComment[];
|
||||
content: string;
|
||||
notes: IReportNote[];
|
||||
insertedAt: Date;
|
||||
updatedAt: Date;
|
||||
insertedAt: string;
|
||||
updatedAt: string;
|
||||
status: ReportStatusEnum;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,15 +19,16 @@ export interface IResource {
|
||||
id?: string;
|
||||
title: string;
|
||||
summary?: string;
|
||||
actor?: IActor;
|
||||
actor?: IGroup;
|
||||
url?: string;
|
||||
resourceUrl: string;
|
||||
path?: string;
|
||||
children: Paginate<IResource>;
|
||||
parent?: IResource;
|
||||
metadata: IResourceMetadata;
|
||||
insertedAt?: Date;
|
||||
updatedAt?: Date;
|
||||
insertedAt?: string;
|
||||
updatedAt?: string;
|
||||
publishedAt?: string;
|
||||
creator?: IActor;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
5
js/src/types/stats.model.ts
Normal file
5
js/src/types/stats.model.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface CategoryStatsModel {
|
||||
key: string;
|
||||
number: number;
|
||||
label?: string;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ export interface ITodo {
|
||||
id?: string;
|
||||
title: string;
|
||||
status: boolean;
|
||||
dueDate?: Date;
|
||||
dueDate?: string;
|
||||
creator?: IActor;
|
||||
assignedTo?: IPerson;
|
||||
todoList?: ITodoList;
|
||||
|
||||
10
js/src/types/user-location.model.ts
Normal file
10
js/src/types/user-location.model.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { PictureInformation } from "./picture";
|
||||
|
||||
export type LocationType = {
|
||||
lat: number | undefined;
|
||||
lon: number | undefined;
|
||||
name: string | undefined;
|
||||
picture?: PictureInformation;
|
||||
isIPLocation?: boolean;
|
||||
accuracy?: number;
|
||||
};
|
||||
Reference in New Issue
Block a user