-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: classification validation, classification on list, can repeat sa…
…me publisher on title screen (#166) * fix: classification validation, classification on list, can repeat same publisher on title screen
- Loading branch information
1 parent
b0bc697
commit 84f29a7
Showing
11 changed files
with
154 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/electron/infra/db/repositories/title/CheckTitleClassificationRepository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import RepositoryBase from '../../RepositoryBase'; | ||
import typeORM from 'typeorm'; | ||
|
||
interface Where { | ||
where: unknown; | ||
} | ||
|
||
export class CheckTitleClassificationRepository extends RepositoryBase { | ||
private static instance: CheckTitleClassificationRepository = null; | ||
|
||
static repositoryName = 'CheckTitleClassification'; | ||
|
||
private constructor() { | ||
super(); | ||
} | ||
|
||
public static getInstance( | ||
typeOrm: typeORM.Repository<unknown> | ||
): CheckTitleClassificationRepository { | ||
if (!CheckTitleClassificationRepository.instance) { | ||
CheckTitleClassificationRepository.instance = | ||
new CheckTitleClassificationRepository(); | ||
} | ||
|
||
CheckTitleClassificationRepository.instance.repository = typeOrm; | ||
|
||
return CheckTitleClassificationRepository.instance; | ||
} | ||
|
||
public async execute(content: Where): Promise<unknown> { | ||
try { | ||
const classifictaionWithTitle = await this.repository.findOne({ | ||
relations: ['title'], | ||
where: content.where, | ||
}); | ||
|
||
return classifictaionWithTitle; | ||
} catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters