This repository has been archived by the owner on Dec 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add field options, rating and logic jump
- Loading branch information
Showing
12 changed files
with
185 additions
and
10 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,13 @@ | ||
import { Field, InputType } from '@nestjs/graphql'; | ||
|
||
@InputType() | ||
export class FormFieldOptionInput { | ||
@Field({ nullable: true }) | ||
readonly key: string | ||
|
||
@Field({ nullable: true }) | ||
readonly title: string | ||
|
||
@Field() | ||
readonly value: string | ||
} |
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,20 @@ | ||
import { Field, ObjectType } from '@nestjs/graphql'; | ||
import { FieldOptionDocument } from '../../schema/embedded/field.option'; | ||
|
||
@ObjectType('FormFieldOption') | ||
export class FormFieldOptionModel { | ||
@Field({ nullable: true }) | ||
readonly key: string | ||
|
||
@Field({ nullable: true }) | ||
readonly title: string | ||
|
||
@Field() | ||
readonly value: string | ||
|
||
constructor(option: FieldOptionDocument) { | ||
this.key = option.key | ||
this.title = option.title | ||
this.value = option.value | ||
} | ||
} |
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,11 @@ | ||
import { Field, InputType } from '@nestjs/graphql'; | ||
import { GraphQLInt } from 'graphql'; | ||
|
||
@InputType() | ||
export class FormFieldRatingInput { | ||
@Field(() => GraphQLInt, { nullable: true }) | ||
readonly steps: number | ||
|
||
@Field({ nullable: true }) | ||
readonly shape: string | ||
} |
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,17 @@ | ||
import { Field, ObjectType } from '@nestjs/graphql'; | ||
import { GraphQLInt } from 'graphql'; | ||
import { RatingFieldDocument } from '../../schema/embedded/rating.field'; | ||
|
||
@ObjectType('FormFieldRating') | ||
export class FormFieldRatingModel { | ||
@Field(() => GraphQLInt, { nullable: true }) | ||
readonly steps: number | ||
|
||
@Field({ nullable: true }) | ||
readonly shape: string | ||
|
||
constructor(option: RatingFieldDocument) { | ||
this.steps = option.steps | ||
this.shape = option.shape | ||
} | ||
} |
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,19 @@ | ||
import { Field, ID, InputType } from '@nestjs/graphql'; | ||
|
||
@InputType() | ||
export class LogicJumpInput { | ||
@Field(() => ID, { nullable: true }) | ||
readonly fieldA: string | ||
|
||
@Field({ nullable: true }) | ||
readonly valueB: string | ||
|
||
@Field({ nullable: true }) | ||
readonly expressionString: string | ||
|
||
@Field(() => ID, { nullable: true }) | ||
readonly jumpTo: string | ||
|
||
@Field({ nullable: true }) | ||
readonly enabled: boolean | ||
} |
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,33 @@ | ||
import { Field, ID, ObjectType } from '@nestjs/graphql'; | ||
import { LogicJumpDocument } from '../../schema/embedded/logic.jump'; | ||
|
||
@ObjectType('LogicJump') | ||
export class LogicJumpModel { | ||
@Field(() => ID, { nullable: true }) | ||
readonly fieldA: string | ||
|
||
@Field({ nullable: true }) | ||
readonly valueB: string | ||
|
||
@Field({ nullable: true }) | ||
readonly expressionString: string | ||
|
||
@Field(() => ID, { nullable: true }) | ||
readonly jumpTo: string | ||
|
||
@Field() | ||
readonly enabled: boolean | ||
|
||
constructor(document: LogicJumpDocument) { | ||
if (!document) { | ||
this.enabled = false | ||
return | ||
} | ||
|
||
this.fieldA = document.fieldA | ||
this.valueB = document.valueB | ||
this.expressionString = document.expressionString | ||
this.jumpTo = document.jumpTo | ||
this.enabled = !!document.enabled | ||
} | ||
} |
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
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