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 { Entity, Column, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { IsNotEmpty, IsString } from 'class-validator';
|
import { IsNotEmpty, IsString } from 'class-validator';
|
||||||
import { AlbumTitleUnique } from './middleware/uniqueAlbumTitle.middleware';
|
|
||||||
import { Song } from '../song/song.entity';
|
import { Song } from '../song/song.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
@ -11,7 +10,6 @@ export class Album {
|
|||||||
@Column()
|
@Column()
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@AlbumTitleUnique()
|
|
||||||
title: string
|
title: string
|
||||||
|
|
||||||
@Column()
|
@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 { Entity, Column, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { IsNotEmpty, IsNumber, IsString } from 'class-validator';
|
import { IsNotEmpty, IsNumber, IsString } from 'class-validator';
|
||||||
import { Album } from '../album/album.entity';
|
import { Album } from '@/album/album.entity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Song {
|
export class Song {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user