Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program content and program queries are created/updated independently #117

Open
CodyGramlich opened this issue Apr 2, 2019 · 0 comments

Comments

@CodyGramlich
Copy link
Collaborator

In protected.controller.ts, these endpoints are not used (which were meant to create or update the program content and program queries together):

    @Post('/program/')
    createProgramWithQueries(
        @Body("user") user,
        @Body("application") application,
    ): any {
        return Observable.zip(
            this.programService.create(user),
            Observable.from(application)
                .mergeMap( (query: ApplicationQueryDto) => this.queryService.create(query))
                .catch(() => Observable.throw(false))
        )
            .map( ([{created}, queriesCreated]) => {
                return created === true && queriesCreated === true ? { created: true} : { created: false }
            })
    }
    @Put('/program/')
    updateProgramWithQueries(@Body() data: any): any {
        return Observable.zip(
            this.programService.index(data.user),
            Observable.from(data.application).mergeMap((query: ApplicationQueryDto) => this.queryService.index(query))
        )
            .map( ([userUpdated, queriesUpdated]) => {
                return userUpdated.created === true && queriesUpdated.created === true ? { updated: true} : { updated: false }
            })
    }

Only PUT protected/program-description/ is used for both creating a program and updating its content (excluding queries):

@Put('/program-description/')
    updateUserFacingProgram(@Body() data): Promise<any> {
        return this.programService.index(data)
    }

I was considering removing the POST protected/program/ and PUT protected/program/ endpoints, but I realized that issue #61 is caused by the program content and program queries being created or updated independently, and we still don't have a solution to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant