refactor(backend): Functions
This commit is contained in:
		
							parent
							
								
									5ec62554e3
								
							
						
					
					
						commit
						65c1a5e6b6
					
				
					 57 changed files with 172 additions and 117 deletions
				
			
		| 
						 | 
				
			
			@ -2,10 +2,10 @@ import { Student } from '../../entities/users/student.entity.js';
 | 
			
		|||
import { DwengoEntityRepository } from '../dwengo-entity-repository.js';
 | 
			
		||||
 | 
			
		||||
export class StudentRepository extends DwengoEntityRepository<Student> {
 | 
			
		||||
    public findByUsername(username: string): Promise<Student | null> {
 | 
			
		||||
    public async findByUsername(username: string): Promise<Student | null> {
 | 
			
		||||
        return this.findOne({ username: username });
 | 
			
		||||
    }
 | 
			
		||||
    public deleteByUsername(username: string): Promise<void> {
 | 
			
		||||
    public async deleteByUsername(username: string): Promise<void> {
 | 
			
		||||
        return this.deleteWhere({ username: username });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,10 +2,10 @@ import { Teacher } from '../../entities/users/teacher.entity.js';
 | 
			
		|||
import { DwengoEntityRepository } from '../dwengo-entity-repository.js';
 | 
			
		||||
 | 
			
		||||
export class TeacherRepository extends DwengoEntityRepository<Teacher> {
 | 
			
		||||
    public findByUsername(username: string): Promise<Teacher | null> {
 | 
			
		||||
    public async findByUsername(username: string): Promise<Teacher | null> {
 | 
			
		||||
        return this.findOne({ username: username });
 | 
			
		||||
    }
 | 
			
		||||
    public deleteByUsername(username: string): Promise<void> {
 | 
			
		||||
    public async deleteByUsername(username: string): Promise<void> {
 | 
			
		||||
        return this.deleteWhere({ username: username });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,10 +2,10 @@ import { DwengoEntityRepository } from '../dwengo-entity-repository.js';
 | 
			
		|||
import { User } from '../../entities/users/user.entity.js';
 | 
			
		||||
 | 
			
		||||
export class UserRepository<T extends User> extends DwengoEntityRepository<T> {
 | 
			
		||||
    public findByUsername(username: string): Promise<T | null> {
 | 
			
		||||
    public async findByUsername(username: string): Promise<T | null> {
 | 
			
		||||
        return this.findOne({ username } as Partial<T>);
 | 
			
		||||
    }
 | 
			
		||||
    public deleteByUsername(username: string): Promise<void> {
 | 
			
		||||
    public async deleteByUsername(username: string): Promise<void> {
 | 
			
		||||
        return this.deleteWhere({ username } as Partial<T>);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue