Skip to content

@sourceloop/survey-service / Exports / SurveyService

Class: SurveyService

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new SurveyService(surveyRepository, questionTemplateRepository, templateQuestionRepository, surveyQuestionRepository, surveyCycleRepository, surveyResponderRepository, questionRepository, surveyCycleService, createSurveyHelperService, logger)

Parameters

Name Type
surveyRepository SurveyRepository
questionTemplateRepository QuestionTemplateRepository
templateQuestionRepository TemplateQuestionRepository
surveyQuestionRepository SurveyQuestionRepository
surveyCycleRepository SurveyCycleRepository
surveyResponderRepository SurveyResponderRepository
questionRepository QuestionRepository
surveyCycleService SurveyCycleService
createSurveyHelperService CreateSurveyHelperService
logger ILogger

Defined in

services/survey-service/src/services/survey.service.ts:31

Properties

createSurveyHelperService

createSurveyHelperService: CreateSurveyHelperService

Defined in

services/survey-service/src/services/survey.service.ts:50


logger

logger: ILogger

Defined in

services/survey-service/src/services/survey.service.ts:51


questionRepository

Protected questionRepository: QuestionRepository

Defined in

services/survey-service/src/services/survey.service.ts:45


questionTemplateRepository

questionTemplateRepository: QuestionTemplateRepository

Defined in

services/survey-service/src/services/survey.service.ts:35


surveyCycleRepository

surveyCycleRepository: SurveyCycleRepository

Defined in

services/survey-service/src/services/survey.service.ts:41


surveyCycleService

surveyCycleService: SurveyCycleService

Defined in

services/survey-service/src/services/survey.service.ts:48


surveyQuestionRepository

surveyQuestionRepository: SurveyQuestionRepository

Defined in

services/survey-service/src/services/survey.service.ts:39


surveyRepository

surveyRepository: SurveyRepository

Defined in

services/survey-service/src/services/survey.service.ts:33


surveyResponderRepository

Protected surveyResponderRepository: SurveyResponderRepository

Defined in

services/survey-service/src/services/survey.service.ts:43


templateQuestionRepository

templateQuestionRepository: TemplateQuestionRepository

Defined in

services/survey-service/src/services/survey.service.ts:37

Methods

_addLeadingZero

Private _addLeadingZero(number, size): string

Parameters

Name Type
number number
size number

Returns

string

Defined in

services/survey-service/src/services/survey.service.ts:367


_checkBasicSurveyValidations

Private _checkBasicSurveyValidations(surveyRequest, existingSurvey?): Promise<void>

Parameters

Name Type
surveyRequest SurveyDto
existingSurvey? SurveyDto

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:170


_checkDateValidationForPatchCase

Private _checkDateValidationForPatchCase(survey, existingSurvey): void

Parameters

Name Type
survey Survey<DataObject<Model>>
existingSurvey Survey<DataObject<Model>>

Returns

void

Defined in

services/survey-service/src/services/survey.service.ts:148


_checkSurveyDateValidations

Private _checkSurveyDateValidations(survey): void

Parameters

Name Type
survey Survey<DataObject<Model>>

Returns

void

Defined in

services/survey-service/src/services/survey.service.ts:202


approveSurveyQuestions

approveSurveyQuestions(surveyId): Promise<void>

Parameters

Name Type
surveyId string

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:332


checkDeleteValidation

checkDeleteValidation(surveyId): Promise<void>

Parameters

Name Type
surveyId string

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:376


checkIfAllowedToUpdateSurvey

checkIfAllowedToUpdateSurvey(id): Promise<void>

Parameters

Name Type
id string

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:298


checkPastDateValidation

checkPastDateValidation(survey): void

Parameters

Name Type
survey Survey<DataObject<Model>>

Returns

void

Defined in

services/survey-service/src/services/survey.service.ts:253


createSurvey

createSurvey(survey): Promise<Survey<DataObject<Model>> & SurveyRelations>

Parameters

Name Type
survey Omit<SurveyDto, "id">

Returns

Promise<Survey<DataObject<Model>> & SurveyRelations>

Defined in

services/survey-service/src/services/survey.service.ts:54


deleteRelatedObjects

deleteRelatedObjects(surveyId): Promise<void>

Parameters

Name Type
surveyId string

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:382


generateSurveyId

generateSurveyId(): Promise<string>

Returns

Promise<string>

Defined in

services/survey-service/src/services/survey.service.ts:346


getHtmlTextContent

Private getHtmlTextContent(html?): string

Parameters

Name Type
html? string

Returns

string

Defined in

services/survey-service/src/services/survey.service.ts:259


handleSurveyApprove

handleSurveyApprove(id, updateSurvey): Promise<void>

Parameters

Name Type
id string
updateSurvey Survey<DataObject<Model>>

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:317


handleSurveyStatus

Private handleSurveyStatus(id, survey): Promise<void>

Parameters

Name Type
id string
survey Survey<DataObject<Model>>

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:307


handleSurveyStatusApprove

handleSurveyStatusApprove(id, status): Promise<void>

Parameters

Name Type
id string
status SurveyStatus

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:325


updateModifiedByAndOn

updateModifiedByAndOn(surveyId): Promise<void>

Parameters

Name Type
surveyId string

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:399


updateSurvey

updateSurvey(id, survey): Promise<void>

Parameters

Name Type
id string
survey SurveyDto

Returns

Promise<void>

Defined in

services/survey-service/src/services/survey.service.ts:270


validateAndGetSurvey

validateAndGetSurvey(surveyId, filter?): Promise<Survey<DataObject<Model>> & SurveyRelations>

Parameters

Name Type
surveyId string
filter Filter<Survey<DataObject<Model>>>

Returns

Promise<Survey<DataObject<Model>> & SurveyRelations>

Defined in

services/survey-service/src/services/survey.service.ts:405


validateTitleLength

validateTitleLength(title): void

Parameters

Name Type
title string

Returns

void

Defined in

services/survey-service/src/services/survey.service.ts:264