add project fields for DepositRequest

This commit is contained in:
amentis 2024-05-16 16:11:36 +03:00
parent 105d86cd98
commit e09f34e391
2 changed files with 24 additions and 4 deletions

View File

@ -4,6 +4,11 @@ export class DepositRequest {
repositoryId: string; repositoryId: string;
dmpId: Guid; dmpId: Guid;
accessToken: String; accessToken: String;
project: DepositRequestFields;
}
export interface DepositRequestFields {
fields: string[];
} }
export class DepositAuthenticateRequest { export class DepositAuthenticateRequest {

View File

@ -3,7 +3,7 @@ import { MatDialog } from '@angular/material/dialog';
import { DomSanitizer, SafeResourceUrl } from "@angular/platform-browser"; import { DomSanitizer, SafeResourceUrl } from "@angular/platform-browser";
import { DepositConfigurationStatus } from '@app/core/common/enum/deposit-configuration-status'; import { DepositConfigurationStatus } from '@app/core/common/enum/deposit-configuration-status';
import { DepositConfiguration } from '@app/core/model/deposit/deposit-configuration'; import { DepositConfiguration } from '@app/core/model/deposit/deposit-configuration';
import { DepositAuthenticateRequest, DepositRequest } from '@app/core/model/deposit/deposit-request'; import { DepositAuthenticateRequest, DepositRequest, DepositRequestFields} from '@app/core/model/deposit/deposit-request';
import { Dmp } from '@app/core/model/dmp/dmp'; import { Dmp } from '@app/core/model/dmp/dmp';
import { EntityDoi } from '@app/core/model/entity-doi/entity-doi'; import { EntityDoi } from '@app/core/model/entity-doi/entity-doi';
import { DepositService } from '@app/core/services/deposit/deposit.service'; import { DepositService } from '@app/core/services/deposit/deposit.service';
@ -16,6 +16,7 @@ import { BaseComponent } from '@common/base/base.component';
import { MultipleChoiceDialogComponent } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.component'; import { MultipleChoiceDialogComponent } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.component';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
@Component({ @Component({
selector: 'app-dmp-deposit-dropdown', selector: 'app-dmp-deposit-dropdown',
@ -82,7 +83,8 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit {
const depositRequest: DepositRequest = { const depositRequest: DepositRequest = {
repositoryId: repo.repositoryId, repositoryId: repo.repositoryId,
dmpId: this.dmp.id, dmpId: this.dmp.id,
accessToken: null accessToken: null,
project: this.EntityDoiFields()
}; };
this.depositRepositoriesService.deposit(depositRequest) this.depositRepositoriesService.deposit(depositRequest)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
@ -99,7 +101,8 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit {
const depositRequest: DepositRequest = { const depositRequest: DepositRequest = {
repositoryId: repo.repositoryId, repositoryId: repo.repositoryId,
dmpId: this.dmp.id, dmpId: this.dmp.id,
accessToken: null accessToken: null,
project: this.EntityDoiFields()
}; };
this.depositRepositoriesService.deposit(depositRequest) this.depositRepositoriesService.deposit(depositRequest)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
@ -135,7 +138,8 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit {
const depositRequest: DepositRequest = { const depositRequest: DepositRequest = {
repositoryId: repo.repositoryId, repositoryId: repo.repositoryId,
dmpId: dmp.id, dmpId: dmp.id,
accessToken: token accessToken: token,
project: this.EntityDoiFields()
}; };
this.depositRepositoriesService.deposit(depositRequest) this.depositRepositoriesService.deposit(depositRequest)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
@ -153,4 +157,15 @@ export class DmpDepositDropdown extends BaseComponent implements OnInit {
}); });
} }
private EntityDoiFields(): DepositRequestFields{
return {
fields: [
[nameof<EntityDoi>(x => x.id)].join('.'),
[nameof<EntityDoi>(x => x.repositoryId)].join('.'),
[nameof<EntityDoi>(x => x.doi)].join('.'),
[nameof<EntityDoi>(x => x.isActive)].join('.'),
]
} as DepositRequestFields;
}
} }