-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: init-command, roleCommandRequest created, change bash to sh to r…
…un init
- Loading branch information
1 parent
46146ae
commit 9466fd4
Showing
4 changed files
with
66 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { IsArray, IsBoolean, IsOptional, IsString, Length } from 'class-validator'; | ||
import { decorate } from 'ts-mixer'; | ||
import RoleRepPayload from '../../Domain/Payloads/RoleRepPayload'; | ||
|
||
class RoleCommandSaveRequest implements RoleRepPayload | ||
{ | ||
private readonly _name: string; | ||
private readonly _slug: string; | ||
private readonly _enable: boolean; | ||
private readonly _permissions: string[]; | ||
|
||
constructor(env: any, role: any = null) | ||
{ | ||
this._name = env.role; | ||
this._slug = env.slug?.toLowerCase() ?? env.role?.toLowerCase(); | ||
this._enable = env.enable ?? true; | ||
this._permissions = []; | ||
} | ||
|
||
@decorate(Length(3, 30)) | ||
@decorate(IsString()) | ||
get name(): string | ||
{ | ||
return this._name; | ||
} | ||
|
||
@decorate(Length(3, 30)) | ||
@decorate(IsString()) | ||
get slug(): string | ||
{ | ||
return this._slug; | ||
} | ||
|
||
@decorate(IsOptional()) | ||
@decorate(IsBoolean()) | ||
get enable(): boolean | ||
{ | ||
return this._enable; | ||
} | ||
|
||
@decorate(IsArray()) | ||
@decorate(IsString({ | ||
each: true | ||
})) | ||
get permissions(): string[] | ||
{ | ||
return this._permissions; | ||
} | ||
} | ||
|
||
export default RoleCommandSaveRequest; |
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