Sfoglia il codice sorgente

partner detail wip

master
Daniel 2 anni fa
parent
commit
c7393f8b7e
13 ha cambiato i file con 82 aggiunte e 26 eliminazioni
  1. +50
    -0
      matsen-tool/openapi.yaml
  2. +3
    -3
      matsen-tool/src/app/_helpers/api.converter.ts
  3. +0
    -1
      matsen-tool/src/app/core/api/v1/.openapi-generator/FILES
  4. +16
    -4
      matsen-tool/src/app/core/api/v1/api/contact.service.ts
  5. +1
    -0
      matsen-tool/src/app/core/api/v1/model/contact.ts
  6. +1
    -0
      matsen-tool/src/app/core/api/v1/model/contactJsonhal.ts
  7. +1
    -0
      matsen-tool/src/app/core/api/v1/model/contactJsonld.ts
  8. +1
    -0
      matsen-tool/src/app/core/api/v1/model/partner.ts
  9. +1
    -0
      matsen-tool/src/app/core/api/v1/model/partnerJsonhal.ts
  10. +1
    -0
      matsen-tool/src/app/core/api/v1/model/partnerJsonld.ts
  11. +1
    -1
      matsen-tool/src/app/partners/partners-detail/partners-detail.component.html
  12. +3
    -14
      matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts
  13. +3
    -3
      matsen-tool/src/app/partners/partners.component.ts

+ 50
- 0
matsen-tool/openapi.yaml Vedi File

@@ -64,6 +64,32 @@ paths:
style: form
explode: 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
post:
operationId: api_contacts_post
@@ -1137,6 +1163,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
imageUrl:
type:
- string
- 'null'
position:
type:
- string
@@ -1198,6 +1228,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
imageUrl:
type:
- string
- 'null'
position:
type:
- string
@@ -1273,6 +1307,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
imageUrl:
type:
- string
- 'null'
position:
type:
- string
@@ -1408,6 +1446,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
logoUrl:
type:
- string
- 'null'
createdAt:
type:
- string
@@ -1475,6 +1517,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
logoUrl:
type:
- string
- 'null'
createdAt:
type:
- string
@@ -1556,6 +1602,10 @@ components:
- 'null'
format: iri-reference
example: 'https://example.com/'
logoUrl:
type:
- string
- 'null'
createdAt:
type:
- string


matsen-tool/src/app/_helpers/api.helper.ts → matsen-tool/src/app/_helpers/api.converter.ts Vedi File

@@ -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) {
const iriRegex = /\/(\d+)$/;
const match = iri.match(iriRegex);
@@ -8,6 +8,6 @@ export class ApiHelper {
return match[1];
}
}
return undefined;
return "";
}
}

+ 0
- 1
matsen-tool/src/app/core/api/v1/.openapi-generator/FILES Vedi File

@@ -1,5 +1,4 @@
.gitignore
.openapi-generator-ignore
README.md
api.module.ts
api/api.ts


+ 16
- 4
matsen-tool/src/app/core/api/v1/api/contact.service.ts Vedi File

@@ -103,19 +103,31 @@ export class ContactService {
* Retrieves the collection of Contact resources.
* Retrieves the collection of Contact resources.
* @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 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});
if (page !== undefined && page !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<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;



+ 1
- 0
matsen-tool/src/app/core/api/v1/model/contact.ts Vedi File

@@ -20,6 +20,7 @@ export interface Contact {
partner?: string | null;
birthday?: string | null;
image?: string | null;
imageUrl?: string | null;
position?: string | null;
phone?: string | null;
email?: string | null;


+ 1
- 0
matsen-tool/src/app/core/api/v1/model/contactJsonhal.ts Vedi File

@@ -22,6 +22,7 @@ export interface ContactJsonhal {
partner?: string | null;
birthday?: string | null;
image?: string | null;
imageUrl?: string | null;
position?: string | null;
phone?: string | null;
email?: string | null;


+ 1
- 0
matsen-tool/src/app/core/api/v1/model/contactJsonld.ts Vedi File

@@ -23,6 +23,7 @@ export interface ContactJsonld {
partner?: string | null;
birthday?: string | null;
image?: string | null;
imageUrl?: string | null;
position?: string | null;
phone?: string | null;
email?: string | null;


+ 1
- 0
matsen-tool/src/app/core/api/v1/model/partner.ts Vedi File

@@ -24,6 +24,7 @@ export interface Partner {
country?: string | null;
website?: string | null;
logo?: string | null;
logoUrl?: string | null;
createdAt?: string | null;
contacts?: Array<string>;
}


+ 1
- 0
matsen-tool/src/app/core/api/v1/model/partnerJsonhal.ts Vedi File

@@ -26,6 +26,7 @@ export interface PartnerJsonhal {
country?: string | null;
website?: string | null;
logo?: string | null;
logoUrl?: string | null;
createdAt?: string | null;
contacts?: Array<string>;
}


+ 1
- 0
matsen-tool/src/app/core/api/v1/model/partnerJsonld.ts Vedi File

@@ -26,6 +26,7 @@ export interface PartnerJsonld {
country?: string | null;
website?: string | null;
logo?: string | null;
logoUrl?: string | null;
createdAt?: string | null;
contacts?: Array<string>;
}


+ 1
- 1
matsen-tool/src/app/partners/partners-detail/partners-detail.component.html Vedi File

@@ -25,7 +25,7 @@
</dl>
</div>
<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}}" />
</div>
</div>


+ 3
- 14
matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts Vedi File

@@ -6,6 +6,7 @@ import {ActivatedRoute} from "@angular/router";
import {ContactJsonld, ContactService, MediaObjectService, PartnerJsonld, PartnerService} from "@app/core/api/v1";
import {Subscription} from "rxjs";
import {environment} from "@environments/environment";
import {ApiConverter} from "@app/_helpers/api.converter";

@Component({
selector: 'app-partners-detail',
@@ -60,25 +61,13 @@ export class PartnersDetailComponent implements OnInit {
getData()
{
this.partnerDetailSub = this.partnerService.partnersIdGet(
"1"
this.id
).subscribe(
data => {
console.log(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(
// TODO: Alle contacts von diesem Partner (id) holen
1, ApiConverter.extractId(this.partner.id)
).subscribe(
data => {
console.log(data);


+ 3
- 3
matsen-tool/src/app/partners/partners.component.ts Vedi File

@@ -6,7 +6,7 @@ import {Subscription} from "rxjs";
import {PartnerJsonld, PartnerService} from "@app/core/api/v1";
import {MatPaginator, MatPaginatorIntl, MatPaginatorModule, PageEvent} from "@angular/material/paginator";
import {OrderFilter} from "@app/_models/orderFilter";
import {ApiHelper} from "@app/_helpers/api.helper";
import {ApiConverter} from "@app/_helpers/api.converter";

@Component({
selector: 'app-partners',
@@ -129,8 +129,8 @@ export class PartnersComponent implements OnInit, AfterViewInit {
const partner: PartnerJsonld = element as PartnerJsonld;
// this.partnerService.setPartnerData(partner);
//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;


Caricamento…
Annulla
Salva