All checks were successful
		
		
	
	continuous-integration/drone/pr Build is passing
				
			ref #132
		
			
				
	
	
		
			39 lines
		
	
	
		
			805 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			805 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {
 | |
|   IsNotEmpty,
 | |
|   IsOptional,
 | |
|   IsString
 | |
| } from "class-validator";
 | |
| import { ChildEntity, Column } from "typeorm";
 | |
| import { ResponseUserGroup } from '../responses/ResponseUserGroup';
 | |
| import { Principal } from './Principal';
 | |
| 
 | |
| /**
 | |
|  * Defines the UserGroup entity.
 | |
|  * This entity describes a group of users with a set of permissions.
 | |
| */
 | |
| @ChildEntity()
 | |
| export class UserGroup extends Principal {
 | |
| 
 | |
|   /**
 | |
|    * The group's name
 | |
|    */
 | |
|   @Column()
 | |
|   @IsNotEmpty()
 | |
|   @IsString()
 | |
|   name: string;
 | |
| 
 | |
|   /**
 | |
|    * The group's description
 | |
|    */
 | |
|   @Column({ nullable: true })
 | |
|   @IsOptional()
 | |
|   @IsString()
 | |
|   description?: string;
 | |
| 
 | |
|   /**
 | |
|    * Turns this entity into it's response class.
 | |
|    */
 | |
|   public toResponse(): ResponseUserGroup {
 | |
|     return new ResponseUserGroup(this);
 | |
|   }
 | |
| } |