-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
material template + material and personnel having own thresholds
- Loading branch information
1 parent
fd9f459
commit e3d6f47
Showing
10 changed files
with
196 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { CanCaterFor } from '../../models/utils'; | ||
import { MaterialTemplate } from '../../models/material-template'; | ||
import type { MaterialType } from '../../models/utils/material-type'; | ||
|
||
const defaultMaterialTemplate = MaterialTemplate.create( | ||
'default', | ||
{ | ||
url: '/assets/material.svg', | ||
height: 40, | ||
aspectRatio: 1, | ||
}, | ||
CanCaterFor.create(2, 2, 2, 'or'), | ||
0.5, | ||
5, | ||
false | ||
); | ||
|
||
export const materialTemplateMap: { | ||
[key in MaterialType]: MaterialTemplate; | ||
} = { | ||
default: defaultMaterialTemplate, | ||
}; |
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
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,55 @@ | ||
import { Type } from 'class-transformer'; | ||
import { | ||
IsBoolean, | ||
IsNumber, | ||
IsString, | ||
Min, | ||
ValidateNested, | ||
} from 'class-validator'; | ||
import { CanCaterFor, ImageProperties, getCreate } from './utils'; | ||
import { MaterialType } from './utils/material-type'; | ||
|
||
export class MaterialTemplate { | ||
@IsString() | ||
public readonly materialType: MaterialType; | ||
|
||
@ValidateNested() | ||
@Type(() => CanCaterFor) | ||
public readonly canCaterFor: CanCaterFor; | ||
|
||
@IsNumber() | ||
@Min(0) | ||
public readonly specificThreshold: number; | ||
|
||
@IsNumber() | ||
@Min(0) | ||
public readonly generalThreshold: number; | ||
|
||
@IsBoolean() | ||
public readonly auraMode: boolean; | ||
|
||
@ValidateNested() | ||
@Type(() => ImageProperties) | ||
public readonly image: ImageProperties; | ||
|
||
/** | ||
* @deprecated Use {@link create} instead | ||
*/ | ||
constructor( | ||
materialType: MaterialType, | ||
image: ImageProperties, | ||
canCaterFor: CanCaterFor, | ||
specificThreshold: number, | ||
generalThreshold: number, | ||
auraMode: boolean | ||
) { | ||
this.materialType = materialType; | ||
this.image = image; | ||
this.canCaterFor = canCaterFor; | ||
this.specificThreshold = specificThreshold; | ||
this.generalThreshold = generalThreshold; | ||
this.auraMode = auraMode; | ||
} | ||
|
||
static readonly create = getCreate(this); | ||
} |
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
Oops, something went wrong.