| @@ -64,6 +64,32 @@ paths: | |||||
| style: form | style: form | ||||
| explode: false | explode: false | ||||
| allowReserved: false | allowReserved: false | ||||
| - | |||||
| name: partner | |||||
| in: query | |||||
| description: '' | |||||
| required: false | |||||
| deprecated: false | |||||
| allowEmptyValue: true | |||||
| schema: | |||||
| type: string | |||||
| style: form | |||||
| explode: false | |||||
| allowReserved: false | |||||
| - | |||||
| name: 'partner[]' | |||||
| in: query | |||||
| description: '' | |||||
| required: false | |||||
| deprecated: false | |||||
| allowEmptyValue: true | |||||
| schema: | |||||
| type: array | |||||
| items: | |||||
| type: string | |||||
| style: form | |||||
| explode: true | |||||
| allowReserved: false | |||||
| deprecated: false | deprecated: false | ||||
| post: | post: | ||||
| operationId: api_contacts_post | operationId: api_contacts_post | ||||
| @@ -1137,6 +1163,10 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| imageUrl: | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| position: | position: | ||||
| type: | type: | ||||
| - string | - string | ||||
| @@ -1198,6 +1228,10 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| imageUrl: | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| position: | position: | ||||
| type: | type: | ||||
| - string | - string | ||||
| @@ -1273,6 +1307,10 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| imageUrl: | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| position: | position: | ||||
| type: | type: | ||||
| - string | - string | ||||
| @@ -1408,6 +1446,10 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| logoUrl: | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| createdAt: | createdAt: | ||||
| type: | type: | ||||
| - string | - string | ||||
| @@ -1475,6 +1517,10 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| logoUrl: | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| createdAt: | createdAt: | ||||
| type: | type: | ||||
| - string | - string | ||||
| @@ -1556,6 +1602,10 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| logoUrl: | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| createdAt: | createdAt: | ||||
| type: | type: | ||||
| - string | - string | ||||
| @@ -1,6 +1,6 @@ | |||||
| export class ApiHelper { | |||||
| export class ApiConverter { | |||||
| public static extractId(iri: string | undefined) { | |||||
| public static extractId(iri: string | undefined): string { | |||||
| if (iri !== undefined) { | if (iri !== undefined) { | ||||
| const iriRegex = /\/(\d+)$/; | const iriRegex = /\/(\d+)$/; | ||||
| const match = iri.match(iriRegex); | const match = iri.match(iriRegex); | ||||
| @@ -8,6 +8,6 @@ export class ApiHelper { | |||||
| return match[1]; | return match[1]; | ||||
| } | } | ||||
| } | } | ||||
| return undefined; | |||||
| return ""; | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,4 @@ | |||||
| .gitignore | .gitignore | ||||
| .openapi-generator-ignore | |||||
| README.md | README.md | ||||
| api.module.ts | api.module.ts | ||||
| api/api.ts | api/api.ts | ||||
| @@ -103,19 +103,31 @@ export class ContactService { | |||||
| * Retrieves the collection of Contact resources. | * Retrieves the collection of Contact resources. | ||||
| * Retrieves the collection of Contact resources. | * Retrieves the collection of Contact resources. | ||||
| * @param page The collection page number | * @param page The collection page number | ||||
| * @param partner | |||||
| * @param partner2 | |||||
| * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | ||||
| * @param reportProgress flag to report request and response progress. | * @param reportProgress flag to report request and response progress. | ||||
| */ | */ | ||||
| public contactsGetCollection(page?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<ApiContactsGetCollection200Response>; | |||||
| public contactsGetCollection(page?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpResponse<ApiContactsGetCollection200Response>>; | |||||
| public contactsGetCollection(page?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpEvent<ApiContactsGetCollection200Response>>; | |||||
| public contactsGetCollection(page?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<any> { | |||||
| public contactsGetCollection(page?: number, partner?: string, partner2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<ApiContactsGetCollection200Response>; | |||||
| public contactsGetCollection(page?: number, partner?: string, partner2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpResponse<ApiContactsGetCollection200Response>>; | |||||
| public contactsGetCollection(page?: number, partner?: string, partner2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpEvent<ApiContactsGetCollection200Response>>; | |||||
| public contactsGetCollection(page?: number, partner?: string, partner2?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<any> { | |||||
| let localVarQueryParameters = new HttpParams({encoder: this.encoder}); | let localVarQueryParameters = new HttpParams({encoder: this.encoder}); | ||||
| if (page !== undefined && page !== null) { | if (page !== undefined && page !== null) { | ||||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | ||||
| <any>page, 'page'); | <any>page, 'page'); | ||||
| } | } | ||||
| if (partner !== undefined && partner !== null) { | |||||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||||
| <any>partner, 'partner'); | |||||
| } | |||||
| if (partner2) { | |||||
| partner2.forEach((element) => { | |||||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||||
| <any>element, 'partner[]'); | |||||
| }) | |||||
| } | |||||
| let localVarHeaders = this.defaultHeaders; | let localVarHeaders = this.defaultHeaders; | ||||
| @@ -20,6 +20,7 @@ export interface Contact { | |||||
| partner?: string | null; | partner?: string | null; | ||||
| birthday?: string | null; | birthday?: string | null; | ||||
| image?: string | null; | image?: string | null; | ||||
| imageUrl?: string | null; | |||||
| position?: string | null; | position?: string | null; | ||||
| phone?: string | null; | phone?: string | null; | ||||
| email?: string | null; | email?: string | null; | ||||
| @@ -22,6 +22,7 @@ export interface ContactJsonhal { | |||||
| partner?: string | null; | partner?: string | null; | ||||
| birthday?: string | null; | birthday?: string | null; | ||||
| image?: string | null; | image?: string | null; | ||||
| imageUrl?: string | null; | |||||
| position?: string | null; | position?: string | null; | ||||
| phone?: string | null; | phone?: string | null; | ||||
| email?: string | null; | email?: string | null; | ||||
| @@ -23,6 +23,7 @@ export interface ContactJsonld { | |||||
| partner?: string | null; | partner?: string | null; | ||||
| birthday?: string | null; | birthday?: string | null; | ||||
| image?: string | null; | image?: string | null; | ||||
| imageUrl?: string | null; | |||||
| position?: string | null; | position?: string | null; | ||||
| phone?: string | null; | phone?: string | null; | ||||
| email?: string | null; | email?: string | null; | ||||
| @@ -24,6 +24,7 @@ export interface Partner { | |||||
| country?: string | null; | country?: string | null; | ||||
| website?: string | null; | website?: string | null; | ||||
| logo?: string | null; | logo?: string | null; | ||||
| logoUrl?: string | null; | |||||
| createdAt?: string | null; | createdAt?: string | null; | ||||
| contacts?: Array<string>; | contacts?: Array<string>; | ||||
| } | } | ||||
| @@ -26,6 +26,7 @@ export interface PartnerJsonhal { | |||||
| country?: string | null; | country?: string | null; | ||||
| website?: string | null; | website?: string | null; | ||||
| logo?: string | null; | logo?: string | null; | ||||
| logoUrl?: string | null; | |||||
| createdAt?: string | null; | createdAt?: string | null; | ||||
| contacts?: Array<string>; | contacts?: Array<string>; | ||||
| } | } | ||||
| @@ -26,6 +26,7 @@ export interface PartnerJsonld { | |||||
| country?: string | null; | country?: string | null; | ||||
| website?: string | null; | website?: string | null; | ||||
| logo?: string | null; | logo?: string | null; | ||||
| logoUrl?: string | null; | |||||
| createdAt?: string | null; | createdAt?: string | null; | ||||
| contacts?: Array<string>; | contacts?: Array<string>; | ||||
| } | } | ||||
| @@ -25,7 +25,7 @@ | |||||
| </dl> | </dl> | ||||
| </div> | </div> | ||||
| <div class="col-4"> | <div class="col-4"> | ||||
| <img src="{{environment.basePath}}{{partnerLogo}}" width="247" height="94" | |||||
| <img *ngIf="partner.logoUrl !== null" src="{{environment.basePath}}{{partner.logoUrl}}" width="247" height="94" | |||||
| alt="{{partner.name}}" title="{{partner.name}}" /> | alt="{{partner.name}}" title="{{partner.name}}" /> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -6,6 +6,7 @@ import {ActivatedRoute} from "@angular/router"; | |||||
| import {ContactJsonld, ContactService, MediaObjectService, PartnerJsonld, PartnerService} from "@app/core/api/v1"; | import {ContactJsonld, ContactService, MediaObjectService, PartnerJsonld, PartnerService} from "@app/core/api/v1"; | ||||
| import {Subscription} from "rxjs"; | import {Subscription} from "rxjs"; | ||||
| import {environment} from "@environments/environment"; | import {environment} from "@environments/environment"; | ||||
| import {ApiConverter} from "@app/_helpers/api.converter"; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-partners-detail', | selector: 'app-partners-detail', | ||||
| @@ -60,25 +61,13 @@ export class PartnersDetailComponent implements OnInit { | |||||
| getData() | getData() | ||||
| { | { | ||||
| this.partnerDetailSub = this.partnerService.partnersIdGet( | this.partnerDetailSub = this.partnerService.partnersIdGet( | ||||
| "1" | |||||
| this.id | |||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| console.log(data); | |||||
| this.partner = data; | this.partner = data; | ||||
| // TODO: logoUrl ist hier falsch, wir müssten nur die ID des logos haben... | |||||
| let logoUrl: string = typeof data.logo === 'string' ? data.logo : ""; | |||||
| this.partnerLogoSub = this.mediaObjectService.mediaObjectsIdGet( | |||||
| // logoUrl | |||||
| "4" | |||||
| ).subscribe( | |||||
| data => { | |||||
| this.partnerLogo = data.contentUrl; | |||||
| console.log(this.partnerLogo); | |||||
| } | |||||
| ); | |||||
| this.partnerContactsSub = this.contactService.contactsGetCollection( | this.partnerContactsSub = this.contactService.contactsGetCollection( | ||||
| // TODO: Alle contacts von diesem Partner (id) holen | |||||
| 1, ApiConverter.extractId(this.partner.id) | |||||
| ).subscribe( | ).subscribe( | ||||
| data => { | data => { | ||||
| console.log(data); | console.log(data); | ||||
| @@ -6,7 +6,7 @@ import {Subscription} from "rxjs"; | |||||
| import {PartnerJsonld, PartnerService} from "@app/core/api/v1"; | import {PartnerJsonld, PartnerService} from "@app/core/api/v1"; | ||||
| import {MatPaginator, MatPaginatorIntl, MatPaginatorModule, PageEvent} from "@angular/material/paginator"; | import {MatPaginator, MatPaginatorIntl, MatPaginatorModule, PageEvent} from "@angular/material/paginator"; | ||||
| import {OrderFilter} from "@app/_models/orderFilter"; | import {OrderFilter} from "@app/_models/orderFilter"; | ||||
| import {ApiHelper} from "@app/_helpers/api.helper"; | |||||
| import {ApiConverter} from "@app/_helpers/api.converter"; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-partners', | selector: 'app-partners', | ||||
| @@ -129,8 +129,8 @@ export class PartnersComponent implements OnInit, AfterViewInit { | |||||
| const partner: PartnerJsonld = element as PartnerJsonld; | const partner: PartnerJsonld = element as PartnerJsonld; | ||||
| // this.partnerService.setPartnerData(partner); | // this.partnerService.setPartnerData(partner); | ||||
| //console.log(partner['@id']); | //console.log(partner['@id']); | ||||
| console.log(ApiHelper.extractId(partner.id)); | |||||
| this.router.navigate(['/customers', ApiHelper.extractId(partner.id)]); | |||||
| console.log(ApiConverter.extractId(partner.id)); | |||||
| this.router.navigate(['/customers', ApiConverter.extractId(partner.id)]); | |||||
| } | } | ||||
| protected readonly PartnerJsonld = PartnerJsonld; | protected readonly PartnerJsonld = PartnerJsonld; | ||||