update: update prettier to major version 2, reformat code accordingly

This commit is contained in:
Xymorot 2020-04-10 05:12:14 +02:00
parent 8fb0b1375e
commit cfa7ba12da
37 changed files with 187 additions and 424 deletions

View File

@ -5,6 +5,7 @@ singleQuote: true
quoteProps: consistent quoteProps: consistent
arrowParens: always arrowParens: always
printWidth: 120 printWidth: 120
endOfLine: lf
overrides: overrides:
- files: '*.svelte' - files: '*.svelte'
options: options:

6
package-lock.json generated
View File

@ -8240,9 +8240,9 @@
"dev": true "dev": true
}, },
"prettier": { "prettier": {
"version": "1.19.1", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", "integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==",
"dev": true "dev": true
}, },
"pretty-bytes": { "pretty-bytes": {

View File

@ -82,7 +82,7 @@
"mocha": "^7.1.1", "mocha": "^7.1.1",
"nock": "^12.0.3", "nock": "^12.0.3",
"nyc": "^15.0.1", "nyc": "^15.0.1",
"prettier": "^1.19.1", "prettier": "^2.0.4",
"rewiremock": "^3.13.9", "rewiremock": "^3.13.9",
"sinon": "^9.0.2", "sinon": "^9.0.2",
"spectron": "^10.0.1", "spectron": "^10.0.1",

View File

@ -8,10 +8,10 @@ import packageJson from '../package.json';
rewiremock.disable(); rewiremock.disable();
describe('Application @slow', function() { describe('Application @slow', function () {
this.timeout(20000); this.timeout(20000);
before(function() { before(function () {
this.app = new Application({ this.app = new Application({
// @ts-ignore this does give the path to electron executable (hopefully platform agnostic) // @ts-ignore this does give the path to electron executable (hopefully platform agnostic)
path: electron.default, path: electron.default,
@ -20,13 +20,13 @@ describe('Application @slow', function() {
return this.app.start(); return this.app.start();
}); });
after(function() { after(function () {
if (this.app && this.app.isRunning()) { if (this.app && this.app.isRunning()) {
return this.app.stop(); return this.app.stop();
} }
}); });
it('shows an initial window', function() { it('shows an initial window', function () {
return this.app.client.getWindowCount().then((count: number) => { return this.app.client.getWindowCount().then((count: number) => {
expect(count).to.be.gte(1); expect(count).to.be.gte(1);
}); });

View File

@ -6,15 +6,11 @@ export class AuthorName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => Author, (author: Author) => author.names, {
() => Author, nullable: false,
(author: Author) => author.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<Author>; public entity: Promise<Author>;
@Column({ @Column({

View File

@ -6,15 +6,11 @@ export class AuthorRoleName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => AuthorRole, (authorRole: AuthorRole) => authorRole.names, {
() => AuthorRole, nullable: false,
(authorRole: AuthorRole) => authorRole.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<AuthorRole>; public entity: Promise<AuthorRole>;
@Column({ @Column({

View File

@ -16,19 +16,13 @@ export class AuthorRole implements IIdentifiableEntity, IMultiNamedEntity, IDesc
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => AuthorRoleName, (authorRoleName: AuthorRoleName) => authorRoleName.entity)
() => AuthorRoleName,
(authorRoleName: AuthorRoleName) => authorRoleName.entity
)
public names: Promise<AuthorRoleName[]>; public names: Promise<AuthorRoleName[]>;
/** /**
* relation to the entity connecting with the author and work * relation to the entity connecting with the author and work
*/ */
@ManyToMany( @ManyToMany(() => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.authorRoles)
() => WorkAuthor,
(workAuthor: WorkAuthor) => workAuthor.authorRoles
)
public workAuthors: Promise<WorkAuthor[]>; public workAuthors: Promise<WorkAuthor[]>;
@Column() @Column()

View File

@ -15,18 +15,12 @@ export class Author implements IIdentifiableEntity, IMultiNamedEntity {
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => AuthorName, (authorName: AuthorName) => authorName.entity)
() => AuthorName,
(authorName: AuthorName) => authorName.entity
)
public names: Promise<AuthorName[]>; public names: Promise<AuthorName[]>;
/** /**
* ultimately connects the author with a work and their role in that work * ultimately connects the author with a work and their role in that work
*/ */
@OneToMany( @OneToMany(() => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.author)
() => WorkAuthor,
(workAuthor: WorkAuthor) => workAuthor.author
)
public workAuthors: Promise<WorkAuthor[]>; public workAuthors: Promise<WorkAuthor[]>;
} }

View File

@ -15,29 +15,21 @@ export class CharacterTag implements IIdentifiableEntity, IWeightedEntity {
/** /**
* the character ina work this tag describes * the character ina work this tag describes
*/ */
@ManyToOne( @ManyToOne(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.characterTags, {
() => WorkCharacter, nullable: false,
(workCharacter: WorkCharacter) => workCharacter.characterTags, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public workCharacter: Promise<WorkCharacter>; public workCharacter: Promise<WorkCharacter>;
/** /**
* the describing tag * the describing tag
*/ */
@ManyToOne( @ManyToOne(() => Tag, (tag: Tag) => tag.characterTags, {
() => Tag, nullable: false,
(tag: Tag) => tag.characterTags, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public tag: Promise<Tag>; public tag: Promise<Tag>;
@Column() @Column()

View File

@ -6,15 +6,11 @@ export class CollectionName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => Collection, (collection: Collection) => collection.names, {
() => Collection, nullable: false,
(collection: Collection) => collection.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<Collection>; public entity: Promise<Collection>;
@Column({ @Column({

View File

@ -14,29 +14,21 @@ export class CollectionPart implements IIdentifiableEntity, IOrderableEntity {
/** /**
* the collection thw work is a part of * the collection thw work is a part of
*/ */
@ManyToOne( @ManyToOne(() => Collection, (collection: Collection) => collection.parts, {
() => Collection, nullable: false,
(collection: Collection) => collection.parts, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public collection: Promise<Collection>; public collection: Promise<Collection>;
/** /**
* the work inside the collection * the work inside the collection
*/ */
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.collectionParts, {
() => Work, nullable: false,
(work: Work) => work.collectionParts, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public work: Promise<Work>; public work: Promise<Work>;
@Column({ @Column({

View File

@ -18,18 +18,12 @@ export class Collection implements IIdentifiableEntity, IMultiNamedEntity {
@Column() @Column()
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => CollectionName, (collectionName: CollectionName) => collectionName.entity)
() => CollectionName,
(collectionName: CollectionName) => collectionName.entity
)
public names: Promise<CollectionName[]>; public names: Promise<CollectionName[]>;
/** /**
* the connecting entity between this collection and the work * the connecting entity between this collection and the work
*/ */
@OneToMany( @OneToMany(() => CollectionPart, (collectionPart: CollectionPart) => collectionPart.collection)
() => CollectionPart,
(collectionPart: CollectionPart) => collectionPart.collection
)
public parts: Promise<CollectionPart[]>; public parts: Promise<CollectionPart[]>;
} }

View File

@ -16,24 +16,17 @@ export class Copy implements IIdentifiableEntity {
/** /**
* the work this entity is a copy of * the work this entity is a copy of
*/ */
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.copies, {
() => Work, nullable: false,
(work: Work) => work.copies, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public original: Promise<Work>; public original: Promise<Work>;
/** /**
* where to find this specific copy * where to find this specific copy
*/ */
@ManyToMany( @ManyToMany(() => Source, (source: Source) => source.copies)
() => Source,
(source: Source) => source.copies
)
public sources: Promise<Source[]>; public sources: Promise<Source[]>;
/** /**

View File

@ -15,33 +15,23 @@ export class InteractionTag implements IIdentifiableEntity, IWeightedEntity {
/** /**
* the describing tag * the describing tag
*/ */
@ManyToOne( @ManyToOne(() => Tag, (tag: Tag) => tag.interactionTags, {
() => Tag, nullable: false,
(tag: Tag) => tag.interactionTags, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public tag: Promise<Tag>; public tag: Promise<Tag>;
/** /**
* the actors of this interaction * the actors of this interaction
*/ */
@ManyToMany( @ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.interactWith)
() => WorkCharacter,
(workCharacter: WorkCharacter) => workCharacter.interactWith
)
public subjectCharacters: Promise<WorkCharacter[]>; public subjectCharacters: Promise<WorkCharacter[]>;
/** /**
* the receivers of this interaction * the receivers of this interaction
*/ */
@ManyToMany( @ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.interactedBy)
() => WorkCharacter,
(workCharacter: WorkCharacter) => workCharacter.interactedBy
)
public objectCharacters: Promise<WorkCharacter[]>; public objectCharacters: Promise<WorkCharacter[]>;
@Column() @Column()

View File

@ -15,9 +15,6 @@ export class Language {
/** /**
* the works using this language * the works using this language
*/ */
@ManyToMany( @ManyToMany(() => Work, (work: Work) => work.languages)
() => Work,
(work: Work) => work.languages
)
public works: Promise<Work[]>; public works: Promise<Work[]>;
} }

View File

@ -6,15 +6,11 @@ export class SiteName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => Site, (site: Site) => site.names, {
() => Site, nullable: false,
(site: Site) => site.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<Site>; public entity: Promise<Site>;
@Column({ @Column({

View File

@ -15,18 +15,12 @@ export class Site implements IIdentifiableEntity, IMultiNamedEntity {
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => SiteName, (siteName: SiteName) => siteName.entity)
() => SiteName,
(siteName: SiteName) => siteName.entity
)
public names: Promise<SiteName[]>; public names: Promise<SiteName[]>;
/** /**
* sources belonging to this site * sources belonging to this site
*/ */
@OneToMany( @OneToMany(() => Source, (source: Source) => source.site)
() => Source,
(source: Source) => source.site
)
public sources: Promise<Source[]>; public sources: Promise<Source[]>;
} }

View File

@ -21,23 +21,16 @@ export class Source implements IIdentifiableEntity {
/** /**
* the site connected to the source * the site connected to the source
*/ */
@ManyToOne( @ManyToOne(() => Site, (site: Site) => site.sources, {
() => Site, nullable: true,
(site: Site) => site.sources, onDelete: 'RESTRICT',
{ onUpdate: 'CASCADE',
nullable: true, })
onDelete: 'RESTRICT',
onUpdate: 'CASCADE',
}
)
public site: Promise<Site>; public site: Promise<Site>;
/** /**
* the copies which can be found here * the copies which can be found here
*/ */
@ManyToMany( @ManyToMany(() => Copy, (copy: Copy) => copy.sources)
() => Copy,
(copy: Copy) => copy.sources
)
public copies: Promise<Copy[]>; public copies: Promise<Copy[]>;
} }

View File

@ -6,15 +6,11 @@ export class TagName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => Tag, (tag: Tag) => tag.names, {
() => Tag, nullable: false,
(tag: Tag) => tag.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<Tag>; public entity: Promise<Tag>;
@Column({ @Column({

View File

@ -20,49 +20,31 @@ export class Tag implements IIdentifiableEntity, IMultiNamedEntity, IDescribable
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => TagName, (tagName: TagName) => tagName.entity)
() => TagName,
(tagName: TagName) => tagName.entity
)
public names: Promise<TagName[]>; public names: Promise<TagName[]>;
/** /**
* this tag tagging a work * this tag tagging a work
*/ */
@OneToMany( @OneToMany(() => WorkTag, (workTag: WorkTag) => workTag.tag)
() => WorkTag,
(workTag: WorkTag) => workTag.tag
)
public workTags: Promise<WorkTag[]>; public workTags: Promise<WorkTag[]>;
/** /**
* this tag tagging characters * this tag tagging characters
*/ */
@OneToMany( @OneToMany(() => CharacterTag, (characterTag: CharacterTag) => characterTag.tag)
() => CharacterTag,
(characterTag: CharacterTag) => characterTag.tag
)
public characterTags: Promise<CharacterTag[]>; public characterTags: Promise<CharacterTag[]>;
/** /**
* this tag tagging a character interaction * this tag tagging a character interaction
*/ */
@OneToMany( @OneToMany(() => InteractionTag, (interactionTag: InteractionTag) => interactionTag.tag)
() => InteractionTag,
(interactionTag: InteractionTag) => interactionTag.tag
)
public interactionTags: Promise<InteractionTag[]>; public interactionTags: Promise<InteractionTag[]>;
@ManyToMany( @ManyToMany(() => Tag, (tag: Tag) => tag.children)
() => Tag,
(tag: Tag) => tag.children
)
public parents: Promise<Tag[]>; public parents: Promise<Tag[]>;
@ManyToMany( @ManyToMany(() => Tag, (tag: Tag) => tag.parents)
() => Tag,
(tag: Tag) => tag.parents
)
public children: Promise<Tag[]>; public children: Promise<Tag[]>;
@Column({ @Column({

View File

@ -6,15 +6,11 @@ export class TransformationTypeName implements IIdentifiableEntity, INameEntity
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => TransformationType, (transformationType: TransformationType) => transformationType.names, {
() => TransformationType, nullable: false,
(transformationType: TransformationType) => transformationType.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<TransformationType>; public entity: Promise<TransformationType>;
@Column({ @Column({

View File

@ -30,10 +30,7 @@ export class TransformationType implements IIdentifiableEntity, IMultiNamedEntit
/** /**
* the transformations of this type * the transformations of this type
*/ */
@OneToMany( @OneToMany(() => Transformation, (transformation: Transformation) => transformation.type)
() => Transformation,
(transformation: Transformation) => transformation.type
)
public transformations: Promise<Transformation[]>; public transformations: Promise<Transformation[]>;
/** /**

View File

@ -13,43 +13,31 @@ export class Transformation implements IIdentifiableEntity, IOrderableEntity {
/** /**
* the work based on the original * the work based on the original
*/ */
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.transformationOf, {
() => Work, nullable: false,
(work: Work) => work.transformationOf, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public byWork: Promise<Work>; public byWork: Promise<Work>;
/** /**
* the transformation type * the transformation type
*/ */
@ManyToOne( @ManyToOne(() => TransformationType, (transformationType: TransformationType) => transformationType.transformations, {
() => TransformationType, nullable: false,
(transformationType: TransformationType) => transformationType.transformations, onDelete: 'RESTRICT',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'RESTRICT',
onUpdate: 'CASCADE',
}
)
public type: Promise<TransformationType>; public type: Promise<TransformationType>;
/** /**
* the original work * the original work
*/ */
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.transformedBy, {
() => Work, nullable: false,
(work: Work) => work.transformedBy, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public ofWork: Promise<Work>; public ofWork: Promise<Work>;
@Column({ @Column({

View File

@ -14,38 +14,27 @@ export class WorkAuthor implements IIdentifiableEntity, IOrderableEntity {
/** /**
* the work * the work
*/ */
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.workAuthors, {
() => Work, nullable: false,
(work: Work) => work.workAuthors, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public work: Promise<Work>; public work: Promise<Work>;
/** /**
* the roles of the author in the work * the roles of the author in the work
*/ */
@ManyToMany( @ManyToMany(() => AuthorRole, (authorRole: AuthorRole) => authorRole.workAuthors)
() => AuthorRole,
(authorRole: AuthorRole) => authorRole.workAuthors
)
public authorRoles: Promise<AuthorRole[]>; public authorRoles: Promise<AuthorRole[]>;
/** /**
* the author * the author
*/ */
@ManyToOne( @ManyToOne(() => Author, (author: Author) => author.workAuthors, {
() => Author, nullable: false,
(author: Author) => author.workAuthors, onDelete: 'RESTRICT',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'RESTRICT',
onUpdate: 'CASCADE',
}
)
public author: Promise<Author>; public author: Promise<Author>;
@Column({ @Column({

View File

@ -6,15 +6,11 @@ export class WorkCharacterName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.names, {
() => WorkCharacter, nullable: false,
(workCharacter: WorkCharacter) => workCharacter.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<WorkCharacter>; public entity: Promise<WorkCharacter>;
@Column({ @Column({

View File

@ -19,59 +19,40 @@ export class WorkCharacter implements IIdentifiableEntity, IMultiNamedEntity {
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => WorkCharacterName, (workCharacterName: WorkCharacterName) => workCharacterName.entity)
() => WorkCharacterName,
(workCharacterName: WorkCharacterName) => workCharacterName.entity
)
public names: Promise<WorkCharacterName[]>; public names: Promise<WorkCharacterName[]>;
/** /**
* the work the character is a part of * the work the character is a part of
*/ */
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.workCharacters, {
() => Work, nullable: false,
(work: Work) => work.workCharacters, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public work: Promise<Work>; public work: Promise<Work>;
/** /**
* interaction with other characters as actor * interaction with other characters as actor
*/ */
@ManyToMany( @ManyToMany(() => InteractionTag, (interactionTag: InteractionTag) => interactionTag.subjectCharacters)
() => InteractionTag,
(interactionTag: InteractionTag) => interactionTag.subjectCharacters
)
public interactWith: Promise<InteractionTag[]>; public interactWith: Promise<InteractionTag[]>;
/** /**
* interaction with other characters as receiver * interaction with other characters as receiver
*/ */
@ManyToMany( @ManyToMany(() => InteractionTag, (interactionTag: InteractionTag) => interactionTag.objectCharacters)
() => InteractionTag,
(interactionTag: InteractionTag) => interactionTag.objectCharacters
)
public interactedBy: Promise<InteractionTag[]>; public interactedBy: Promise<InteractionTag[]>;
/** /**
* tags connected to the character * tags connected to the character
*/ */
@OneToMany( @OneToMany(() => CharacterTag, (characterTag: CharacterTag) => characterTag.workCharacter)
() => CharacterTag,
(characterTag: CharacterTag) => characterTag.workCharacter
)
public characterTags: Promise<CharacterTag[]>; public characterTags: Promise<CharacterTag[]>;
/** /**
* existing characters characer is based on * existing characters characer is based on
*/ */
@ManyToMany( @ManyToMany(() => WorldCharacter, (worldCharacter: WorldCharacter) => worldCharacter.workCharacters)
() => WorldCharacter,
(worldCharacter: WorldCharacter) => worldCharacter.workCharacters
)
public worldCharacters: Promise<WorldCharacter[]>; public worldCharacters: Promise<WorldCharacter[]>;
} }

View File

@ -6,15 +6,11 @@ export class WorkName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.names, {
() => Work, nullable: false,
(work: Work) => work.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<Work>; public entity: Promise<Work>;
@Column({ @Column({

View File

@ -15,29 +15,21 @@ export class WorkTag implements IIdentifiableEntity, IWeightedEntity {
/** /**
* the describing tag * the describing tag
*/ */
@ManyToOne( @ManyToOne(() => Tag, (tag: Tag) => tag.workTags, {
() => Tag, nullable: false,
(tag: Tag) => tag.workTags, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public tag: Promise<Tag>; public tag: Promise<Tag>;
/** /**
* the tagged work * the tagged work
*/ */
@ManyToOne( @ManyToOne(() => Work, (work: Work) => work.workTags, {
() => Work, nullable: false,
(work: Work) => work.workTags, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public work: Promise<Work>; public work: Promise<Work>;
@Column() @Column()

View File

@ -26,73 +26,49 @@ export class Work implements IIdentifiableEntity, IMultiNamedEntity {
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => WorkName, (workName: WorkName) => workName.entity)
() => WorkName,
(workName: WorkName) => workName.entity
)
public names: Promise<WorkName[]>; public names: Promise<WorkName[]>;
/** /**
* digital representations of this work * digital representations of this work
*/ */
@OneToMany( @OneToMany(() => Copy, (copy: Copy) => copy.original)
() => Copy,
(copy: Copy) => copy.original
)
public copies: Promise<Copy[]>; public copies: Promise<Copy[]>;
/** /**
* other works this work is a transformation of * other works this work is a transformation of
*/ */
@OneToMany( @OneToMany(() => Transformation, (transformation: Transformation) => transformation.byWork)
() => Transformation,
(transformation: Transformation) => transformation.byWork
)
public transformationOf: Promise<Transformation[]>; public transformationOf: Promise<Transformation[]>;
/** /**
* other works this work is transformed by * other works this work is transformed by
*/ */
@OneToMany( @OneToMany(() => Transformation, (transformation: Transformation) => transformation.ofWork)
() => Transformation,
(transformation: Transformation) => transformation.ofWork
)
public transformedBy: Promise<Transformation[]>; public transformedBy: Promise<Transformation[]>;
/** /**
* the authors/publishers of this work * the authors/publishers of this work
*/ */
@OneToMany( @OneToMany(() => WorkAuthor, (workAuthor: WorkAuthor) => workAuthor.work)
() => WorkAuthor,
(workAuthor: WorkAuthor) => workAuthor.work
)
public workAuthors: Promise<WorkAuthor[]>; public workAuthors: Promise<WorkAuthor[]>;
/** /**
* tags describing this work * tags describing this work
*/ */
@OneToMany( @OneToMany(() => WorkTag, (workTag: WorkTag) => workTag.work)
() => WorkTag,
(workTag: WorkTag) => workTag.work
)
public workTags: Promise<WorkTag[]>; public workTags: Promise<WorkTag[]>;
/** /**
* characters in this work * characters in this work
*/ */
@OneToMany( @OneToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.work)
() => WorkCharacter,
(workCharacter: WorkCharacter) => workCharacter.work
)
public workCharacters: Promise<WorkCharacter[]>; public workCharacters: Promise<WorkCharacter[]>;
/** /**
* fictional worlds in which this work takes place * fictional worlds in which this work takes place
*/ */
@ManyToMany( @ManyToMany(() => World, (world: World) => world.works)
() => World,
(world: World) => world.works
)
public worlds: Promise<World[]>; public worlds: Promise<World[]>;
/** /**
@ -123,18 +99,12 @@ export class Work implements IIdentifiableEntity, IMultiNamedEntity {
/** /**
* the languages of the work (if applicable) * the languages of the work (if applicable)
*/ */
@ManyToMany( @ManyToMany(() => Language, (language: Language) => language.works)
() => Language,
(language: Language) => language.works
)
public languages: Promise<Language[]>; public languages: Promise<Language[]>;
/** /**
* the collections this work is a part of * the collections this work is a part of
*/ */
@OneToMany( @OneToMany(() => CollectionPart, (collectionPart: CollectionPart) => collectionPart.work)
() => CollectionPart,
(collectionPart: CollectionPart) => collectionPart.work
)
public collectionParts: Promise<CollectionPart[]>; public collectionParts: Promise<CollectionPart[]>;
} }

View File

@ -6,15 +6,11 @@ export class WorldCharacterName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => WorldCharacter, (worldCharacter: WorldCharacter) => worldCharacter.names, {
() => WorldCharacter, nullable: false,
(worldCharacter: WorldCharacter) => worldCharacter.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<WorldCharacter>; public entity: Promise<WorldCharacter>;
@Column({ @Column({

View File

@ -16,39 +16,24 @@ export class WorldCharacter implements IIdentifiableEntity, IMultiNamedEntity, I
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => WorldCharacterName, (worldCharacterName: WorldCharacterName) => worldCharacterName.entity)
() => WorldCharacterName,
(worldCharacterName: WorldCharacterName) => worldCharacterName.entity
)
public names: Promise<WorldCharacterName[]>; public names: Promise<WorldCharacterName[]>;
/** /**
* the characters in works which are based on this one * the characters in works which are based on this one
*/ */
@ManyToMany( @ManyToMany(() => WorkCharacter, (workCharacter: WorkCharacter) => workCharacter.worldCharacters)
() => WorkCharacter,
(workCharacter: WorkCharacter) => workCharacter.worldCharacters
)
public workCharacters: Promise<WorkCharacter[]>; public workCharacters: Promise<WorkCharacter[]>;
/** /**
* the fictional worlds this character is a part of * the fictional worlds this character is a part of
*/ */
@ManyToMany( @ManyToMany(() => World, (world: World) => world.worldCharacters)
() => World,
(world: World) => world.worldCharacters
)
public worlds: Promise<World[]>; public worlds: Promise<World[]>;
@ManyToMany( @ManyToMany(() => WorldCharacter, (worldCharacter: WorldCharacter) => worldCharacter.children)
() => WorldCharacter,
(worldCharacter: WorldCharacter) => worldCharacter.children
)
public parents: Promise<WorldCharacter[]>; public parents: Promise<WorldCharacter[]>;
@ManyToMany( @ManyToMany(() => WorldCharacter, (worldCharacter: WorldCharacter) => worldCharacter.parents)
() => WorldCharacter,
(worldCharacter: WorldCharacter) => worldCharacter.parents
)
public children: Promise<WorldCharacter[]>; public children: Promise<WorldCharacter[]>;
} }

View File

@ -6,15 +6,11 @@ export class WorldName implements IIdentifiableEntity, INameEntity {
@PrimaryGeneratedColumn() @PrimaryGeneratedColumn()
public id: number; public id: number;
@ManyToOne( @ManyToOne(() => World, (world: World) => world.names, {
() => World, nullable: false,
(world: World) => world.names, onDelete: 'CASCADE',
{ onUpdate: 'CASCADE',
nullable: false, })
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
)
public entity: Promise<World>; public entity: Promise<World>;
@Column({ @Column({

View File

@ -16,39 +16,24 @@ export class World implements IIdentifiableEntity, IMultiNamedEntity, IHierachic
}) })
public nameCanonical: string; public nameCanonical: string;
@OneToMany( @OneToMany(() => WorldName, (worldName: WorldName) => worldName.entity)
() => WorldName,
(worldName: WorldName) => worldName.entity
)
public names: Promise<WorldName[]>; public names: Promise<WorldName[]>;
/** /**
* works taking place in this world * works taking place in this world
*/ */
@ManyToMany( @ManyToMany(() => Work, (work: Work) => work.worlds)
() => Work,
(work: Work) => work.worlds
)
public works: Promise<Work[]>; public works: Promise<Work[]>;
/** /**
* canon characters in this world * canon characters in this world
*/ */
@ManyToMany( @ManyToMany(() => WorldCharacter, (worldCharacter: WorldCharacter) => worldCharacter.worlds)
() => WorldCharacter,
(worldCharacter: WorldCharacter) => worldCharacter.worlds
)
public worldCharacters: Promise<WorldCharacter[]>; public worldCharacters: Promise<WorldCharacter[]>;
@ManyToMany( @ManyToMany(() => World, (world: World) => world.parents)
() => World,
(world: World) => world.parents
)
public children: Promise<World[]>; public children: Promise<World[]>;
@ManyToMany( @ManyToMany(() => World, (world: World) => world.children)
() => World,
(world: World) => world.children
)
public parents: Promise<World[]>; public parents: Promise<World[]>;
} }

View File

@ -10,7 +10,7 @@ import { load, save, StoreKeys } from './store';
const storeDirectory = path.resolve(appPath, 'store'); const storeDirectory = path.resolve(appPath, 'store');
describe('Store Service', function() { describe('Store Service', function () {
this.timeout(10000); this.timeout(10000);
before(() => { before(() => {

View File

@ -10,7 +10,7 @@ import sinon from 'sinon';
import { WebCrawler } from './web-crawler'; import { WebCrawler } from './web-crawler';
import { storeMock } from '../store/store.mock'; import { storeMock } from '../store/store.mock';
describe('Web Crawler', function() { describe('Web Crawler', function () {
this.timeout(2000); this.timeout(2000);
before(() => { before(() => {

View File

@ -3,7 +3,7 @@ import fc from 'fast-check';
import 'mocha'; import 'mocha';
import { c, s, t } from './utils'; import { c, s, t } from './utils';
describe('Frontend Utils', function() { describe('Frontend Utils', function () {
this.timeout(1000); this.timeout(1000);
it("does 'translate' text", () => { it("does 'translate' text", () => {
@ -11,7 +11,7 @@ describe('Frontend Utils', function() {
}); });
describe('Class Util', () => { describe('Class Util', () => {
beforeEach(function() { beforeEach(function () {
const numeric = fc.integer(0x30, 0x39); const numeric = fc.integer(0x30, 0x39);
const alphaCapital = fc.integer(0x41, 0x5a); const alphaCapital = fc.integer(0x41, 0x5a);
const alphaSmall = fc.integer(0x61, 0x7a); const alphaSmall = fc.integer(0x61, 0x7a);
@ -29,7 +29,7 @@ describe('Frontend Utils', function() {
.filter((thing) => typeof thing !== 'string'); .filter((thing) => typeof thing !== 'string');
}); });
it('compiles classes out of an array', function() { it('compiles classes out of an array', function () {
const classArrayArbitrary = fc.array(fc.oneof(this.className, this.anything)); const classArrayArbitrary = fc.array(fc.oneof(this.className, this.anything));
fc.assert( fc.assert(
@ -45,7 +45,7 @@ describe('Frontend Utils', function() {
); );
}); });
it('compiles classes out of an object', function() { it('compiles classes out of an object', function () {
const classObjectArbitrary = fc.object({ const classObjectArbitrary = fc.object({
maxDepth: 0, maxDepth: 0,
key: this.className, key: this.className,

View File

@ -2,7 +2,7 @@ import { expect } from 'chai';
import 'mocha'; import 'mocha';
import { uuid } from './uuid'; import { uuid } from './uuid';
describe('UUID Service', function() { describe('UUID Service', function () {
this.timeout(1000); this.timeout(1000);
it('provides universal unique identifiers', () => { it('provides universal unique identifiers', () => {