Fix eslint warnings

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-27 19:27:44 +01:00
parent 487ac56b4c
commit da42522073
130 changed files with 702 additions and 734 deletions

View File

@@ -1,12 +1,5 @@
import { IMedia } from "@/types/media.model";
export enum ActorType {
PERSON = "PERSON",
APPLICATION = "APPLICATION",
GROUP = "GROUP",
ORGANISATION = "ORGANISATION",
SERVICE = "SERVICE",
}
import type { IMedia } from "@/types/media.model";
import { ActorType } from "../enums";
export interface IActor {
id?: string;

View File

@@ -1,4 +1,4 @@
import { IActor } from "@/types/actor/actor.model";
import type { IActor } from "@/types/actor/actor.model";
export interface IFollower {
id?: string;

View File

@@ -1,38 +1,15 @@
import { Actor, ActorType, IActor } from "./actor.model";
import { Paginate } from "../paginate";
import { IResource } from "../resource";
import { ITodoList } from "../todos";
import { IEvent } from "../event.model";
import { IDiscussion } from "../discussions";
import { IPerson } from "./person.model";
import { IPost } from "../post.model";
import { IAddress, Address } from "../address.model";
export enum MemberRole {
NOT_APPROVED = "NOT_APPROVED",
INVITED = "INVITED",
MEMBER = "MEMBER",
MODERATOR = "MODERATOR",
ADMINISTRATOR = "ADMINISTRATOR",
CREATOR = "CREATOR",
REJECTED = "REJECTED",
}
export enum Openness {
INVITE_ONLY = "INVITE_ONLY",
MODERATED = "MODERATED",
OPEN = "OPEN",
}
export interface IMember {
id?: string;
role: MemberRole;
parent: IGroup;
actor: IActor;
invitedBy?: IPerson;
insertedAt: string;
updatedAt: string;
}
import type { IActor } from "./actor.model";
import { Actor } from "./actor.model";
import type { Paginate } from "../paginate";
import type { IResource } from "../resource";
import type { IEvent } from "../event.model";
import type { IDiscussion } from "../discussions";
import type { IPost } from "../post.model";
import type { IAddress } from "../address.model";
import { Address } from "../address.model";
import { ActorType, Openness } from "../enums";
import type { IMember } from "./member.model";
import type { ITodoList } from "../todolist";
export interface IGroup extends IActor {
members: Paginate<IMember>;

View File

@@ -0,0 +1,12 @@
import type { IActor, IGroup, IPerson } from ".";
import { MemberRole } from "../enums";
export interface IMember {
id?: string;
role: MemberRole;
parent: IGroup;
actor: IActor;
invitedBy?: IPerson;
insertedAt: string;
updatedAt: string;
}

View File

@@ -1,15 +1,11 @@
import { ICurrentUser } from "../current-user.model";
import { IEvent } from "../event.model";
import { Actor, IActor } from "./actor.model";
import { Paginate } from "../paginate";
import { IMember } from "./group.model";
import { IParticipant } from "../participant.model";
export interface IFeedToken {
token: string;
actor?: IPerson;
user: ICurrentUser;
}
import type { ICurrentUser } from "../current-user.model";
import type { IEvent } from "../event.model";
import { Actor } from "./actor.model";
import type { IActor } from "./actor.model";
import type { Paginate } from "../paginate";
import type { IParticipant } from "../participant.model";
import type { IMember } from "./member.model";
import type { IFeedToken } from "../feedtoken.model";
export interface IPerson extends IActor {
feedTokens: IFeedToken[];

View File

@@ -1,4 +1,5 @@
import { poiIcons, IPOIIcon } from "@/utils/poiIcons";
import { poiIcons } from "@/utils/poiIcons";
import type { IPOIIcon } from "@/utils/poiIcons";
export interface IAddress {
id?: string;
@@ -53,7 +54,7 @@ export class Address implements IAddress {
this.originId = hash.originId;
}
get poiInfos() {
get poiInfos(): { name: string; alternativeName: string; poiIcon: IPOIIcon } {
/* generate name corresponding to poi type */
let name = "";
let alternativeName = "";

View File

@@ -1,5 +1,6 @@
import { IEvent } from "@/types/event.model";
import { IGroup } from "./actor";
import type { IEvent } from "@/types/event.model";
import type { IGroup } from "./actor";
import { InstanceTermsType } from "./enums";
export interface IDashboard {
lastPublicEventPublished: IEvent;
@@ -14,23 +15,10 @@ export interface IDashboard {
numberOfConfirmedParticipationsToLocalEvents: number;
}
export enum InstanceTermsType {
DEFAULT = "DEFAULT",
URL = "URL",
CUSTOM = "CUSTOM",
}
export enum InstancePrivacyType {
DEFAULT = "DEFAULT",
URL = "URL",
CUSTOM = "CUSTOM",
}
export interface ILanguage {
code: string;
name: string;
}
export interface IAdminSettings {
instanceName: string;
instanceDescription: string;

View File

@@ -1,5 +1,7 @@
import { Actor, IActor } from "@/types/actor";
import { EventModel, IEvent } from "@/types/event.model";
import { Actor } from "@/types/actor";
import type { IActor } from "@/types/actor";
import type { IEvent } from "@/types/event.model";
import { EventModel } from "@/types/event.model";
export interface IComment {
id?: string;

View File

@@ -1,5 +1,5 @@
import { InstanceTermsType, InstancePrivacyType } from "./admin.model";
import { IProvider } from "./resource";
import { InstancePrivacyType, InstanceTermsType } from "./enums";
import type { IProvider } from "./resource";
export interface IOAuthProvider {
id: string;

View File

@@ -1,13 +1,8 @@
import { IEvent } from "@/types/event.model";
import { IPerson } from "@/types/actor/person.model";
import { Paginate } from "./paginate";
import { IParticipant } from "./participant.model";
export enum ICurrentUserRole {
USER = "USER",
MODERATOR = "MODERATOR",
ADMINISTRATOR = "ADMINISTRATOR",
}
import type { IEvent } from "@/types/event.model";
import type { IPerson } from "@/types/actor/person.model";
import type { Paginate } from "./paginate";
import type { IParticipant } from "./participant.model";
import { ICurrentUserRole, INotificationPendingEnum } from "./enums";
export interface ICurrentUser {
id: string;
@@ -17,13 +12,6 @@ export interface ICurrentUser {
defaultActor?: IPerson;
}
export enum INotificationPendingEnum {
NONE = "NONE",
DIRECT = "DIRECT",
ONE_DAY = "ONE_DAY",
ONE_HOUR = "ONE_HOUR",
}
export interface IUserSettings {
timezone: string;
notificationOnDay: boolean;
@@ -49,14 +37,3 @@ export interface IUser extends ICurrentUser {
currentSignInIp: string;
currentSignInAt: string;
}
export enum IAuthProvider {
LDAP = "ldap",
GOOGLE = "google",
DISCORD = "discord",
GITHUB = "github",
KEYCLOAK = "keycloak",
FACEBOOK = "facebook",
GITLAB = "gitlab",
TWITTER = "twitter",
}

View File

@@ -1,6 +1,7 @@
import { IActor, IPerson } from "@/types/actor";
import { IComment, CommentModel } from "@/types/comment.model";
import { Paginate } from "@/types/paginate";
import type { IActor, IPerson } from "@/types/actor";
import type { IComment } from "@/types/comment.model";
import { CommentModel } from "@/types/comment.model";
import type { Paginate } from "@/types/paginate";
export interface IDiscussion {
id?: string;

161
js/src/types/enums.ts Normal file
View File

@@ -0,0 +1,161 @@
export enum InstanceTermsType {
DEFAULT = "DEFAULT",
URL = "URL",
CUSTOM = "CUSTOM",
}
export enum InstancePrivacyType {
DEFAULT = "DEFAULT",
URL = "URL",
CUSTOM = "CUSTOM",
}
export enum ICurrentUserRole {
USER = "USER",
MODERATOR = "MODERATOR",
ADMINISTRATOR = "ADMINISTRATOR",
}
export enum INotificationPendingEnum {
NONE = "NONE",
DIRECT = "DIRECT",
ONE_DAY = "ONE_DAY",
ONE_HOUR = "ONE_HOUR",
}
export enum IAuthProvider {
LDAP = "ldap",
GOOGLE = "google",
DISCORD = "discord",
GITHUB = "github",
KEYCLOAK = "keycloak",
FACEBOOK = "facebook",
GITLAB = "gitlab",
TWITTER = "twitter",
}
export enum ErrorCode {
UNKNOWN = "unknown",
REGISTRATION_CLOSED = "registration_closed",
}
export enum CommentModeration {
ALLOW_ALL = "ALLOW_ALL",
MODERATED = "MODERATED",
CLOSED = "CLOSED",
}
export enum EventStatus {
TENTATIVE = "TENTATIVE",
CONFIRMED = "CONFIRMED",
CANCELLED = "CANCELLED",
}
export enum EventVisibility {
PUBLIC = "PUBLIC",
UNLISTED = "UNLISTED",
RESTRICTED = "RESTRICTED",
PRIVATE = "PRIVATE",
}
export enum EventJoinOptions {
FREE = "FREE",
RESTRICTED = "RESTRICTED",
INVITE = "INVITE",
}
export enum EventVisibilityJoinOptions {
PUBLIC = "PUBLIC",
LINK = "LINK",
LIMITED = "LIMITED",
}
export enum Category {
BUSINESS = "business",
CONFERENCE = "conference",
BIRTHDAY = "birthday",
DEMONSTRATION = "demonstration",
MEETING = "meeting",
}
export enum LoginErrorCode {
NEED_TO_LOGIN = "need_to_login",
}
export enum LoginError {
USER_NOT_CONFIRMED = "User account not confirmed",
USER_DOES_NOT_EXIST = "No user with this email was found",
USER_EMAIL_PASSWORD_INVALID = "Impossible to authenticate, either your email or password are invalid.",
LOGIN_PROVIDER_ERROR = "Error with Login Provider",
LOGIN_PROVIDER_NOT_FOUND = "Login Provider not found",
USER_DISABLED = "This user has been disabled",
}
export enum ResetError {
USER_IMPOSSIBLE_TO_RESET = "This user can't reset their password",
}
export enum ParticipantRole {
NOT_APPROVED = "NOT_APPROVED",
NOT_CONFIRMED = "NOT_CONFIRMED",
REJECTED = "REJECTED",
PARTICIPANT = "PARTICIPANT",
MODERATOR = "MODERATOR",
ADMINISTRATOR = "ADMINISTRATOR",
CREATOR = "CREATOR",
}
export enum PostVisibility {
PUBLIC = "PUBLIC",
UNLISTED = "UNLISTED",
RESTRICTED = "RESTRICTED",
PRIVATE = "PRIVATE",
}
export enum ReportStatusEnum {
OPEN = "OPEN",
CLOSED = "CLOSED",
RESOLVED = "RESOLVED",
}
export enum ActionLogAction {
NOTE_CREATION = "NOTE_CREATION",
NOTE_DELETION = "NOTE_DELETION",
REPORT_UPDATE_CLOSED = "REPORT_UPDATE_CLOSED",
REPORT_UPDATE_OPENED = "REPORT_UPDATE_OPENED",
REPORT_UPDATE_RESOLVED = "REPORT_UPDATE_RESOLVED",
EVENT_DELETION = "EVENT_DELETION",
COMMENT_DELETION = "COMMENT_DELETION",
ACTOR_SUSPENSION = "ACTOR_SUSPENSION",
ACTOR_UNSUSPENSION = "ACTOR_UNSUSPENSION",
USER_DELETION = "USER_DELETION",
}
export enum SearchTabs {
EVENTS = 0,
GROUPS = 1,
}
export enum ActorType {
PERSON = "PERSON",
APPLICATION = "APPLICATION",
GROUP = "GROUP",
ORGANISATION = "ORGANISATION",
SERVICE = "SERVICE",
}
export enum MemberRole {
NOT_APPROVED = "NOT_APPROVED",
INVITED = "INVITED",
MEMBER = "MEMBER",
MODERATOR = "MODERATOR",
ADMINISTRATOR = "ADMINISTRATOR",
CREATOR = "CREATOR",
REJECTED = "REJECTED",
}
export enum Openness {
INVITE_ONLY = "INVITE_ONLY",
MODERATED = "MODERATED",
OPEN = "OPEN",
}

View File

@@ -1,4 +0,0 @@
export enum ErrorCode {
UNKNOWN = "unknown",
REGISTRATION_CLOSED = "registration_closed",
}

View File

@@ -1,3 +1,5 @@
import { CommentModeration } from "./enums";
export interface IParticipationCondition {
title: string;
content: string;
@@ -10,12 +12,6 @@ export interface IOffer {
url: string;
}
export enum CommentModeration {
ALLOW_ALL = "ALLOW_ALL",
MODERATED = "MODERATED",
CLOSED = "CLOSED",
}
export interface IEventOptions {
maximumAttendeeCapacity: number;
remainingAttendeeCapacity: number;

View File

@@ -1,44 +1,15 @@
import { Address, IAddress } from "@/types/address.model";
import { ITag } from "@/types/tag.model";
import { IMedia } from "@/types/media.model";
import { IComment } from "@/types/comment.model";
import { Paginate } from "@/types/paginate";
import { Actor, Group, IActor, IGroup, IPerson } from "./actor";
import { IParticipant } from "./participant.model";
import { EventOptions, IEventOptions } from "./event-options.model";
export enum EventStatus {
TENTATIVE = "TENTATIVE",
CONFIRMED = "CONFIRMED",
CANCELLED = "CANCELLED",
}
export enum EventVisibility {
PUBLIC = "PUBLIC",
UNLISTED = "UNLISTED",
RESTRICTED = "RESTRICTED",
PRIVATE = "PRIVATE",
}
export enum EventJoinOptions {
FREE = "FREE",
RESTRICTED = "RESTRICTED",
INVITE = "INVITE",
}
export enum EventVisibilityJoinOptions {
PUBLIC = "PUBLIC",
LINK = "LINK",
LIMITED = "LIMITED",
}
export enum Category {
BUSINESS = "business",
CONFERENCE = "conference",
BIRTHDAY = "birthday",
DEMONSTRATION = "demonstration",
MEETING = "meeting",
}
import { Address } from "@/types/address.model";
import type { IAddress } from "@/types/address.model";
import type { ITag } from "@/types/tag.model";
import type { IMedia } from "@/types/media.model";
import type { IComment } from "@/types/comment.model";
import type { Paginate } from "@/types/paginate";
import { Actor, Group } from "./actor";
import type { IActor, IGroup, IPerson } from "./actor";
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";
export interface IEventCardOptions {
hideDate: boolean;

View File

@@ -0,0 +1,8 @@
import type { IPerson } from "./actor";
import type { ICurrentUser } from "./current-user.model";
export interface IFeedToken {
token: string;
actor?: IPerson;
user: ICurrentUser;
}

View File

@@ -1,16 +0,0 @@
export enum LoginErrorCode {
NEED_TO_LOGIN = "need_to_login",
}
export enum LoginError {
USER_NOT_CONFIRMED = "User account not confirmed",
USER_DOES_NOT_EXIST = "No user with this email was found",
USER_EMAIL_PASSWORD_INVALID = "Impossible to authenticate, either your email or password are invalid.",
LOGIN_PROVIDER_ERROR = "Error with Login Provider",
LOGIN_PROVIDER_NOT_FOUND = "Login Provider not found",
USER_DISABLED = "This user has been disabled",
}
export enum ResetError {
USER_IMPOSSIBLE_TO_RESET = "This user can't reset their password",
}

View File

@@ -1,4 +1,4 @@
import { ICurrentUser } from "@/types/current-user.model";
import type { ICurrentUser } from "@/types/current-user.model";
export interface IToken {
accessToken: string;

View File

@@ -1,15 +1,8 @@
import { Actor, IActor } from "./actor";
import { EventModel, IEvent } from "./event.model";
export enum ParticipantRole {
NOT_APPROVED = "NOT_APPROVED",
NOT_CONFIRMED = "NOT_CONFIRMED",
REJECTED = "REJECTED",
PARTICIPANT = "PARTICIPANT",
MODERATOR = "MODERATOR",
ADMINISTRATOR = "ADMINISTRATOR",
CREATOR = "CREATOR",
}
import { Actor } from "./actor";
import type { IActor } from "./actor";
import { EventModel } from "./event.model";
import type { IEvent } from "./event.model";
import { ParticipantRole } from "./enums";
export interface IParticipant {
id?: string;

View File

@@ -1,13 +1,7 @@
import { ITag } from "./tag.model";
import { IMedia } from "./media.model";
import { IActor } from "./actor";
export enum PostVisibility {
PUBLIC = "PUBLIC",
UNLISTED = "UNLISTED",
RESTRICTED = "RESTRICTED",
PRIVATE = "PRIVATE",
}
import type { ITag } from "./tag.model";
import type { IMedia } from "./media.model";
import type { IActor } from "./actor";
import type { PostVisibility } from "./enums";
export interface IPost {
id?: string;

View File

@@ -1,13 +1,16 @@
import { IActor, IPerson } from "@/types/actor";
import { IEvent } from "@/types/event.model";
import { IComment } from "@/types/comment.model";
import type { IActor, IPerson } from "@/types/actor";
import type { IEvent } from "@/types/event.model";
import type { IComment } from "@/types/comment.model";
import { ActionLogAction, ReportStatusEnum } from "./enums";
export enum ReportStatusEnum {
OPEN = "OPEN",
CLOSED = "CLOSED",
RESOLVED = "RESOLVED",
export interface IActionLogObject {
id: string;
}
export interface IReportNote extends IActionLogObject {
id: string;
content: string;
moderator: IActor;
}
export interface IReport extends IActionLogObject {
id: string;
reported: IActor;
@@ -21,29 +24,6 @@ export interface IReport extends IActionLogObject {
status: ReportStatusEnum;
}
export interface IReportNote extends IActionLogObject {
id: string;
content: string;
moderator: IActor;
}
export interface IActionLogObject {
id: string;
}
export enum ActionLogAction {
NOTE_CREATION = "NOTE_CREATION",
NOTE_DELETION = "NOTE_DELETION",
REPORT_UPDATE_CLOSED = "REPORT_UPDATE_CLOSED",
REPORT_UPDATE_OPENED = "REPORT_UPDATE_OPENED",
REPORT_UPDATE_RESOLVED = "REPORT_UPDATE_RESOLVED",
EVENT_DELETION = "EVENT_DELETION",
COMMENT_DELETION = "COMMENT_DELETION",
ACTOR_SUSPENSION = "ACTOR_SUSPENSION",
ACTOR_UNSUSPENSION = "ACTOR_UNSUSPENSION",
USER_DELETION = "USER_DELETION",
}
export interface IActionLog {
id: string;
object: IReport | IReportNote | IEvent | IComment | IActor;

View File

@@ -1,6 +1,20 @@
import { Paginate } from "@/types/paginate";
import { IActor } from "@/types/actor";
import type { Paginate } from "@/types/paginate";
import type { IActor } from "@/types/actor";
export interface IResourceMetadata {
title?: string;
description?: string;
imageRemoteUrl?: string;
height?: number;
width?: number;
type?: string;
authorName?: string;
authorUrl?: string;
providerName?: string;
providerUrl?: string;
html?: string;
faviconUrl?: string;
}
export interface IResource {
id?: string;
title: string;
@@ -18,22 +32,7 @@ export interface IResource {
type?: string;
}
export interface IResourceMetadata {
title?: string;
description?: string;
imageRemoteUrl?: string;
height?: number;
width?: number;
type?: string;
authorName?: string;
authorUrl?: string;
providerName?: string;
providerUrl?: string;
html?: string;
faviconUrl?: string;
}
export const mapServiceTypeToIcon: object = {
export const mapServiceTypeToIcon: Record<string, string> = {
pad: "file-document-outline",
calc: "google-spreadsheet",
visio: "webcam",

View File

@@ -1,5 +1,5 @@
import { IGroup, IPerson } from "@/types/actor";
import { IEvent } from "@/types/event.model";
import type { IGroup, IPerson } from "@/types/actor";
import type { IEvent } from "@/types/event.model";
export interface SearchEvent {
total: number;
@@ -15,8 +15,3 @@ export interface SearchPerson {
total: number;
elements: IPerson[];
}
export enum SearchTabs {
EVENTS = 0,
GROUPS = 1,
}

10
js/src/types/todolist.ts Normal file
View File

@@ -0,0 +1,10 @@
import type { IActor } from "./actor";
import type { Paginate } from "./paginate";
import type { ITodo } from "./todos";
export interface ITodoList {
id: string;
title: string;
todos: Paginate<ITodo>;
actor?: IActor;
}

View File

@@ -1,12 +1,5 @@
import { Paginate } from "@/types/paginate";
import { IActor, IPerson } from "@/types/actor";
export interface ITodoList {
id: string;
title: string;
todos: Paginate<ITodo>;
actor?: IActor;
}
import type { IActor, IPerson } from "@/types/actor";
import { ITodoList } from "./todolist";
export interface ITodo {
id?: string;