-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a2a94a
commit f713f5b
Showing
7 changed files
with
63 additions
and
3 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
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,21 @@ | ||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; | ||
import { HydratedDocument } from 'mongoose'; | ||
|
||
export type OrgSettingsDocument = HydratedDocument<OrgSettings>; | ||
|
||
export enum OrgValueCalculationStrategy { | ||
BuyPrice = 'buyPrice', | ||
SellPrice = 'sellPrice', | ||
} | ||
|
||
@Schema({ _id: false }) | ||
export class OrgSettings { | ||
@Prop({ | ||
type: String, | ||
enum: Object.values(OrgValueCalculationStrategy), | ||
default: OrgValueCalculationStrategy.SellPrice, | ||
}) | ||
valueCalculationStrategy: OrgValueCalculationStrategy; | ||
} | ||
|
||
export const OrgSettingsSchema = SchemaFactory.createForClass(OrgSettings); |
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
7 changes: 7 additions & 0 deletions
7
packages/shared-types/src/organizations/PatchOrganizationSettingsDto.ts
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,7 @@ | ||
import { IsIn, IsOptional } from "class-validator"; | ||
|
||
export class PatchOrganizationSettingsDto { | ||
@IsOptional() | ||
@IsIn(['buyPrice', 'sellPrice']) | ||
valueCalculationStrategy?: string; | ||
} |