Browse Source

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

0.x
Xymorot 1 year ago
parent
commit
cfa7ba12da
37 changed files with 187 additions and 424 deletions
  1. +1
    -0
      .prettierrc.yml
  2. +3
    -3
      package-lock.json
  3. +1
    -1
      package.json
  4. +4
    -4
      src/main.spec.ts
  5. +5
    -9
      src/main/entities/library/author-name.ts
  6. +5
    -9
      src/main/entities/library/author-role-name.ts
  7. +2
    -8
      src/main/entities/library/author-role.ts
  8. +2
    -8
      src/main/entities/library/author.ts
  9. +10
    -18
      src/main/entities/library/character-tag.ts
  10. +5
    -9
      src/main/entities/library/collection-name.ts
  11. +10
    -18
      src/main/entities/library/collection-part.ts
  12. +2
    -8
      src/main/entities/library/collection.ts
  13. +6
    -13
      src/main/entities/library/copy.ts
  14. +7
    -17
      src/main/entities/library/interaction-tag.ts
  15. +1
    -4
      src/main/entities/library/language.ts
  16. +5
    -9
      src/main/entities/library/site-name.ts
  17. +2
    -8
      src/main/entities/library/site.ts
  18. +6
    -13
      src/main/entities/library/source.ts
  19. +5
    -9
      src/main/entities/library/tag-name.ts
  20. +6
    -24
      src/main/entities/library/tag.ts
  21. +5
    -9
      src/main/entities/library/transformation-type-name.ts
  22. +1
    -4
      src/main/entities/library/transformation-type.ts
  23. +15
    -27
      src/main/entities/library/transformation.ts
  24. +11
    -22
      src/main/entities/library/work-author.ts
  25. +5
    -9
      src/main/entities/library/work-character-name.ts
  26. +10
    -29
      src/main/entities/library/work-character.ts
  27. +5
    -9
      src/main/entities/library/work-name.ts
  28. +10
    -18
      src/main/entities/library/work-tag.ts
  29. +10
    -40
      src/main/entities/library/work.ts
  30. +5
    -9
      src/main/entities/library/world-character-name.ts
  31. +5
    -20
      src/main/entities/library/world-character.ts
  32. +5
    -9
      src/main/entities/library/world-name.ts
  33. +5
    -20
      src/main/entities/library/world.ts
  34. +1
    -1
      src/main/modules/store/store.spec.ts
  35. +1
    -1
      src/main/modules/web-crawler/web-crawler.spec.ts
  36. +4
    -4
      src/renderer/services/utils.spec.ts
  37. +1
    -1
      src/services/uuid.spec.ts

+ 1
- 0
.prettierrc.yml View File

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


+ 3
- 3
package-lock.json View File

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


+ 1
- 1
package.json View File

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


+ 4
- 4
src/main.spec.ts View File

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


+ 5
- 9
src/main/entities/library/author-name.ts View File

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


+ 5
- 9
src/main/entities/library/author-role-name.ts View File

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


+ 2
- 8
src/main/entities/library/author-role.ts View File

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


+ 2
- 8
src/main/entities/library/author.ts View File

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

+ 10
- 18
src/main/entities/library/character-tag.ts View File

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


+ 5
- 9
src/main/entities/library/collection-name.ts View File

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


+ 10
- 18
src/main/entities/library/collection-part.ts View File

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


+ 2
- 8
src/main/entities/library/collection.ts View File

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

+ 6
- 13
src/main/entities/library/copy.ts View File

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


+ 7
- 17
src/main/entities/library/interaction-tag.ts View File

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


+ 1
- 4
src/main/entities/library/language.ts View File

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

+ 5
- 9
src/main/entities/library/site-name.ts View File

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


+ 2
- 8
src/main/entities/library/site.ts View File

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

+ 6
- 13
src/main/entities/library/source.ts View File

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

+ 5
- 9
src/main/entities/library/tag-name.ts View File

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


+ 6
- 24
src/main/entities/library/tag.ts View File

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


+ 5
- 9
src/main/entities/library/transformation-type-name.ts View File

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


+ 1
- 4
src/main/entities/library/transformation-type.ts View File

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


+ 15
- 27
src/main/entities/library/transformation.ts View File

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


+ 11
- 22
src/main/entities/library/work-author.ts View File

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


+ 5
- 9
src/main/entities/library/work-character-name.ts View File

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


+ 10
- 29
src/main/entities/library/work-character.ts View File

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

+ 5
- 9
src/main/entities/library/work-name.ts View File

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


+ 10
- 18
src/main/entities/library/work-tag.ts View File

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


+ 10
- 40
src/main/entities/library/work.ts View File

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

+ 5
- 9
src/main/entities/library/world-character-name.ts View File

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


+ 5
- 20
src/main/entities/library/world-character.ts View File

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

+ 5
- 9
src/main/entities/library/world-name.ts View File

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


+ 5
- 20
src/main/entities/library/world.ts View File

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

+ 1
- 1
src/main/modules/store/store.spec.ts View File

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


+ 1
- 1
src/main/modules/web-crawler/web-crawler.spec.ts View File

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


+ 4
- 4
src/renderer/services/utils.spec.ts View File

@ -3,7 +3,7 @@ import fc from 'fast-check';
import 'mocha';
import { c, s, t } from './utils';
describe('Frontend Utils', function() {
describe('Frontend Utils', function () {
this.timeout(1000);
it("does 'translate' text", () => {
@ -11,7 +11,7 @@ describe('Frontend Utils', function() {
});
describe('Class Util', () => {
beforeEach(function() {
beforeEach(function () {
const numeric = fc.integer(0x30, 0x39);
const alphaCapital = fc.integer(0x41, 0x5a);
const alphaSmall = fc.integer(0x61, 0x7a);
@ -29,7 +29,7 @@ describe('Frontend Utils', function() {
.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));
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({
maxDepth: 0,
key: this.className,


+ 1
- 1
src/services/uuid.spec.ts View File

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


Loading…
Cancel
Save