Removing due to circular dependency
Some checks failed
Music Collection CI Workflow / test (./frontend) (push) Successful in 36s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Has been skipped
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Has been skipped
Music Collection CI Workflow / deploy (push) Has been skipped
Music Collection CI Workflow / test (./backend) (push) Failing after 29s
Some checks failed
Music Collection CI Workflow / test (./frontend) (push) Successful in 36s
Music Collection CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/music-collection-backend, ./backend) (push) Has been skipped
Music Collection CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/music-collection-frontend, ./frontend) (push) Has been skipped
Music Collection CI Workflow / deploy (push) Has been skipped
Music Collection CI Workflow / test (./backend) (push) Failing after 29s
This commit is contained in:
parent
f94a4d21e8
commit
556f9c9927
@ -1,6 +1,5 @@
|
||||
import { Entity, Column, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { IsNotEmpty, IsString } from 'class-validator';
|
||||
import { AlbumTitleUnique } from './middleware/uniqueAlbumTitle.middleware';
|
||||
import { Song } from '../song/song.entity';
|
||||
|
||||
@Entity()
|
||||
@ -11,7 +10,6 @@ export class Album {
|
||||
@Column()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@AlbumTitleUnique()
|
||||
title: string
|
||||
|
||||
@Column()
|
||||
|
@ -1,32 +0,0 @@
|
||||
import { registerDecorator, ValidationOptions, ValidatorConstraint, ValidatorConstraintInterface } from 'class-validator';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@ValidatorConstraint({ async: true })
|
||||
export class UniqueAlbumTitle implements ValidatorConstraintInterface {
|
||||
constructor(@InjectRepository(Album)
|
||||
private albumRepository: Repository<Album>
|
||||
) {}
|
||||
|
||||
validate(albumTitle: string) {
|
||||
return this.albumRepository.findOneBy({
|
||||
where: {
|
||||
id: title
|
||||
}).then((albumTitle) => {
|
||||
return albumTitle === undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function AlbumTitleUnique(validationOptions?: ValidationOptions) {
|
||||
return function (object: object, propertyName: string) {
|
||||
registerDecorator({
|
||||
target: object.constructor,
|
||||
propertyName: propertyName,
|
||||
options: validationOptions,
|
||||
constraints: [],
|
||||
validator: AlbumTitleUnique,
|
||||
});
|
||||
};
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { Entity, Column, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { IsNotEmpty, IsNumber, IsString } from 'class-validator';
|
||||
import { Album } from '../album/album.entity';
|
||||
import { Album } from '@/album/album.entity';
|
||||
|
||||
@Entity()
|
||||
export class Song {
|
||||
|
Loading…
x
Reference in New Issue
Block a user