Quellcode durchsuchen

partner detail wip

master
Daniel vor 2 Jahren
Ursprung
Commit
c7393f8b7e
13 geänderte Dateien mit 82 neuen und 26 gelöschten Zeilen
  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 Datei anzeigen

@@ -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


matsen-tool/src/app/_helpers/api.helper.ts → matsen-tool/src/app/_helpers/api.converter.ts Datei anzeigen

@@ -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 "";
} }
} }

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

@@ -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


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

@@ -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;




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

@@ -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;


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

@@ -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;


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

@@ -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;


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

@@ -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>;
} }


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

@@ -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>;
} }


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

@@ -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>;
} }


+ 1
- 1
matsen-tool/src/app/partners/partners-detail/partners-detail.component.html Datei anzeigen

@@ -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>


+ 3
- 14
matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts Datei anzeigen

@@ -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);


+ 3
- 3
matsen-tool/src/app/partners/partners.component.ts Datei anzeigen

@@ -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;


Laden…
Abbrechen
Speichern