Skip to content

Commit

Permalink
BREAKING CHANGE: new sdk release (SciCatProject#1658)
Browse files Browse the repository at this point in the history
* feat: add the new auth service to prepare for the new sdk

* try to fix some ai-bot review suggestions

* add the note for the good review suggestion from ai-bot

* remove old sdk and adjust types against the new one

* fix more types and issues against the new sdk

* finalize type error fixes

* remove prefix

* add the new sdk generation script for local development

* start fixing TODOs after newly generated sdk

* fixed sdk local generation for linux

* update the sdk package version and fix some more types

* detect the OS and use the right current directory path

* improve types and fix more TODOs

* improve types and fix TODOs after backend improvements

* finalize TODOs and FIXMEs fixes and type improvements with the new sdk

* fix some sourcery-ai comments

* fix some of the last TODOs

* adapted sdk generation to unix environment

* ignore the @SciCatProject that is generated with the sdk

* start fixing tests with the new sdk

* add needed stub classes and fix some more tests

* continue fixing unit tests

* try to fix e2e tests and revert some changes that need more attention for now

* changes to just run the tests

* use latest sdk

* update package-lock file

* fixing unit tests

* fix more unit tests

* continue fixing tests

* update the sdk

* fix last e2e test

* fix thumbnail unit tests

* revert some change

* finalize fixing unit tests

* revert the backend image changes after the tests pass

* add some improvements in the mocked objects for unit tests based on ai bot suggestion

* remove encodeURIComponent in the effects as it seems redundant

* fix test files after some changes

* try to use mock objects as much as possible

* update the sdk version

* update package-lock file

* update the sdk to latest

* BREAKING CHANGE: new sdk release

---------

Co-authored-by: martintrajanovski <[email protected]>
Co-authored-by: Jay <[email protected]>
  • Loading branch information
3 people authored and sofyalaski committed Dec 17, 2024
1 parent 4c34fff commit 63f2698
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
10 changes: 1 addition & 9 deletions src/app/datasets/dataset-detail/dataset-detail.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
Component,
OnInit,
Output,
EventEmitter,
OnDestroy,
Inject,
} from "@angular/core";
import { Dataset, Proposal, Sample } from "shared/sdk/models";
import { Component, OnInit, OnDestroy, Inject } from "@angular/core";
import { ENTER, COMMA, SPACE } from "@angular/cdk/keycodes";
import { MatChipInputEvent } from "@angular/material/chips";

Expand Down
36 changes: 20 additions & 16 deletions src/app/state-management/effects/proposals.effects.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Injectable } from "@angular/core";
import { Actions, createEffect, ofType, concatLatestFrom } from "@ngrx/effects";
import { DatasetApi, ProposalApi, Proposal, Dataset } from "shared/sdk";
import {
DatasetsService,
ProposalClass,
ProposalsService,
} from "@scicatproject/scicat-sdk-ts";
import { Action, Store } from "@ngrx/store";
import * as fromActions from "state-management/actions/proposals.actions";
import {
Expand Down Expand Up @@ -271,28 +275,28 @@ export class ProposalEffects {

private createProposalFetchEffect(
triggerAction: string,
completeAction: (props: { proposal: Proposal }) => Action,
completeAction: (props: { proposal: ProposalClass }) => Action,
failedAction: () => Action,
accessFailedAction: () => Action,
) {
return createEffect(() => {
return this.actions$.pipe(
ofType(triggerAction),
switchMap<Proposal, ObservableInput<Action>>(({ proposalId }) =>
this.proposalApi.findByIdAccess(encodeURIComponent(proposalId)).pipe(
filter(
(permission: { canAccess: boolean }) => permission.canAccess,
),
switchMap(() =>
this.proposalApi
.findById<Proposal>(encodeURIComponent(proposalId))
.pipe(
map((proposal) => completeAction({ proposal })),
catchError(() => of(failedAction())),
),
switchMap<ProposalClass, ObservableInput<Action>>(({ proposalId }) =>
this.proposalsService
.proposalsControllerFindByIdAccess(proposalId)
.pipe(
filter((permission) => permission.canAccess),
switchMap(() =>
this.proposalsService
.proposalsControllerFindById(proposalId)
.pipe(
map((proposal) => completeAction({ proposal })),
catchError(() => of(failedAction())),
),
),
catchError(() => of(accessFailedAction())),
),
catchError(() => of(accessFailedAction())),
),
),
);
});
Expand Down

0 comments on commit 63f2698

Please sign in to comment.