@sourceloop/survey-service / Exports / QuestionHelperService
Class: QuestionHelperService¶
Table of contents¶
Constructors¶
Properties¶
- logger
- optionsRepository
- questionRepository
- surveyQuestionRepository
- surveyService
- templateQuestionRepository
Methods¶
- _addLeadingZero
- _createDefaultOptions
- _createFollowupQuestion
- _deleteAllOptionsByQuestion
- _handleQuestionTypeChange
- checkAndGetIfAllowedQuestionToUpdate
- checkIfAllowedToUpdate
- checkIfUsedInTemplateOrSurvey
- createQuestion
- deleteQuestion
- findQuestionWithOptions
- generateQuestionUuid
- handleApprove
- handleOnStatusChange
- updateAllChildStatus
- updateQuestion
- validateParentQuestion
Constructors¶
constructor¶
• new QuestionHelperService(questionRepository
, optionsRepository
, templateQuestionRepository
, surveyQuestionRepository
, surveyService
, logger
)
Parameters¶
Name | Type |
---|---|
questionRepository |
QuestionRepository |
optionsRepository |
OptionsRepository |
templateQuestionRepository |
TemplateQuestionRepository |
surveyQuestionRepository |
SurveyQuestionRepository |
surveyService |
SurveyService |
logger |
ILogger |
Defined in¶
services/survey-service/src/services/question-helper.service.ts:21
Properties¶
logger¶
• logger: ILogger
Defined in¶
services/survey-service/src/services/question-helper.service.ts:32
optionsRepository¶
• optionsRepository: OptionsRepository
Defined in¶
services/survey-service/src/services/question-helper.service.ts:25
questionRepository¶
• questionRepository: QuestionRepository
Defined in¶
services/survey-service/src/services/question-helper.service.ts:23
surveyQuestionRepository¶
• surveyQuestionRepository: SurveyQuestionRepository
Defined in¶
services/survey-service/src/services/question-helper.service.ts:29
surveyService¶
• surveyService: SurveyService
Defined in¶
services/survey-service/src/services/question-helper.service.ts:31
templateQuestionRepository¶
• templateQuestionRepository: TemplateQuestionRepository
Defined in¶
services/survey-service/src/services/question-helper.service.ts:27
Methods¶
_addLeadingZero¶
▸ _addLeadingZero(number
, size
): string
Parameters¶
Name | Type |
---|---|
number |
number |
size |
number |
Returns¶
string
Defined in¶
services/survey-service/src/services/question-helper.service.ts:160
_createDefaultOptions¶
▸ _createDefaultOptions(questionId
, questionType
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
questionId |
string |
questionType |
QuestionType |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:170
_createFollowupQuestion¶
▸ _createFollowupQuestion(question
, optionId
): Promise
<Question
>
Parameters¶
Name | Type |
---|---|
question |
Question |
optionId |
string |
Returns¶
Promise
<Question
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:92
_deleteAllOptionsByQuestion¶
▸ _deleteAllOptionsByQuestion(question
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
question |
Question |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:229
_handleQuestionTypeChange¶
▸ _handleQuestionTypeChange(question
, existingQuestion
, questionId
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
question |
Question |
existingQuestion |
Question |
questionId |
string |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:296
checkAndGetIfAllowedQuestionToUpdate¶
▸ checkAndGetIfAllowedQuestionToUpdate(questionId
, question?
): Promise
<{ existingQuestion
: Question
& QuestionRelations
}>
Parameters¶
Name | Type |
---|---|
questionId |
string |
question? |
Question |
Returns¶
Promise
<{ existingQuestion
: Question
& QuestionRelations
}>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:384
checkIfAllowedToUpdate¶
▸ checkIfAllowedToUpdate(existingQuestion
, updateQuestion?
): void
Parameters¶
Name | Type |
---|---|
existingQuestion |
Question |
updateQuestion? |
Question |
Returns¶
void
Defined in¶
services/survey-service/src/services/question-helper.service.ts:326
checkIfUsedInTemplateOrSurvey¶
▸ checkIfUsedInTemplateOrSurvey(questionId
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
questionId |
string |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:336
createQuestion¶
▸ createQuestion(question
, status?
): Promise
<Question
>
Parameters¶
Name | Type | Default value |
---|---|---|
question |
QuestionDto |
undefined |
status |
string |
QuestionStatus.DRAFT |
Returns¶
Promise
<Question
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:35
deleteQuestion¶
▸ deleteQuestion(id
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
id |
string |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:199
findQuestionWithOptions¶
▸ findQuestionWithOptions(questionId
): Promise
<Question
>
Parameters¶
Name | Type |
---|---|
questionId |
string |
Returns¶
Promise
<Question
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:237
generateQuestionUuid¶
▸ generateQuestionUuid(questionId?
): Promise
<string
>
Parameters¶
Name | Type |
---|---|
questionId? |
string |
Returns¶
Promise
<string
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:137
handleApprove¶
▸ handleApprove(id
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
id |
string |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:313
handleOnStatusChange¶
▸ handleOnStatusChange(id
, updateQuestion
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
id |
string |
updateQuestion |
Question |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:355
updateAllChildStatus¶
▸ updateAllChildStatus(id
, status
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
id |
string |
status |
QuestionStatus |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:317
updateQuestion¶
▸ updateQuestion(questionId
, question
): Promise
<Question
& QuestionRelations
>
Parameters¶
Name | Type |
---|---|
questionId |
string |
question |
Question |
Returns¶
Promise
<Question
& QuestionRelations
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:256
validateParentQuestion¶
▸ validateParentQuestion(parentQuestionId
): Promise
<void
>
Parameters¶
Name | Type |
---|---|
parentQuestionId |
undefined | string |
Returns¶
Promise
<void
>
Defined in¶
services/survey-service/src/services/question-helper.service.ts:363