diff --git a/matsen-tool/generateApi.sh b/matsen-tool/generateApi.sh index 4b6bf4a..e1eb262 100644 --- a/matsen-tool/generateApi.sh +++ b/matsen-tool/generateApi.sh @@ -1,4 +1,5 @@ npm run generate:api + find ./src/app/core/api/v1/model -type f -exec sed -i '' -e '' -e "s/hydramember/'hydra:member'/g" {} + find ./src/app/core/api/v1/model -type f -exec sed -i '' -e '' -e "s/hydratotalItems/'hydra:totalItems'/g" {} + find ./src/app/core/api/v1/model -type f -exec sed -i '' -e "s/hydraview/'hydra:view'/g" {} + diff --git a/matsen-tool/openapi.yaml b/matsen-tool/openapi.yaml index 6f8e0a5..086c6e7 100644 --- a/matsen-tool/openapi.yaml +++ b/matsen-tool/openapi.yaml @@ -795,6 +795,58 @@ 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 + - + name: contact + in: query + description: '' + required: false + deprecated: false + allowEmptyValue: true + schema: + type: string + style: form + explode: false + allowReserved: false + - + name: 'contact[]' + 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_posts_post @@ -1239,6 +1291,7 @@ components: format: iri-reference example: 'https://example.com/' imageUrl: + readOnly: true type: - string - 'null' @@ -1304,6 +1357,7 @@ components: format: iri-reference example: 'https://example.com/' imageUrl: + readOnly: true type: - string - 'null' @@ -1383,6 +1437,7 @@ components: format: iri-reference example: 'https://example.com/' imageUrl: + readOnly: true type: - string - 'null' @@ -1522,6 +1577,7 @@ components: format: iri-reference example: 'https://example.com/' logoUrl: + readOnly: true type: - string - 'null' @@ -1593,6 +1649,7 @@ components: format: iri-reference example: 'https://example.com/' logoUrl: + readOnly: true type: - string - 'null' @@ -1678,6 +1735,7 @@ components: format: iri-reference example: 'https://example.com/' logoUrl: + readOnly: true type: - string - 'null' @@ -1697,8 +1755,13 @@ components: description: '' deprecated: false required: + - headline - message properties: + headline: + type: + - string + - 'null' message: type: - string @@ -1710,6 +1773,11 @@ components: - 'null' format: iri-reference example: 'https://example.com/' + ownerName: + readOnly: true + type: + - string + - 'null' partner: anyOf: - @@ -1733,6 +1801,7 @@ components: description: '' deprecated: false required: + - headline - message properties: _links: @@ -1744,6 +1813,10 @@ components: href: type: string format: iri-reference + headline: + type: + - string + - 'null' message: type: - string @@ -1755,6 +1828,11 @@ components: - 'null' format: iri-reference example: 'https://example.com/' + ownerName: + readOnly: true + type: + - string + - 'null' partner: anyOf: - @@ -1778,6 +1856,7 @@ components: description: '' deprecated: false required: + - headline - message properties: '@context': @@ -1803,6 +1882,10 @@ components: '@type': readOnly: true type: string + headline: + type: + - string + - 'null' message: type: - string @@ -1814,6 +1897,11 @@ components: - 'null' format: iri-reference example: 'https://example.com/' + ownerName: + readOnly: true + type: + - string + - 'null' partner: anyOf: - diff --git a/matsen-tool/src/app/core/api/v1/api/post.service.ts b/matsen-tool/src/app/core/api/v1/api/post.service.ts index 82a1826..ff0083d 100644 --- a/matsen-tool/src/app/core/api/v1/api/post.service.ts +++ b/matsen-tool/src/app/core/api/v1/api/post.service.ts @@ -104,13 +104,17 @@ export class PostService { * Retrieves the collection of Post resources. * @param page The collection page number * @param itemsPerPage The number of items per page + * @param partner + * @param partner2 + * @param contact + * @param contact2 * @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 postsGetCollection(page?: number, itemsPerPage?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable; - public postsGetCollection(page?: number, itemsPerPage?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable>; - public postsGetCollection(page?: number, itemsPerPage?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable>; - public postsGetCollection(page?: number, itemsPerPage?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable { + public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array, contact?: string, contact2?: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable; + public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array, contact?: string, contact2?: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable>; + public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array, contact?: string, contact2?: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable>; + public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array, contact?: string, contact2?: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable { let localVarQueryParameters = new HttpParams({encoder: this.encoder}); if (page !== undefined && page !== null) { @@ -121,6 +125,26 @@ export class PostService { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, itemsPerPage, 'itemsPerPage'); } + if (partner !== undefined && partner !== null) { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + partner, 'partner'); + } + if (partner2) { + partner2.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'partner[]'); + }) + } + if (contact !== undefined && contact !== null) { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + contact, 'contact'); + } + if (contact2) { + contact2.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'contact[]'); + }) + } let localVarHeaders = this.defaultHeaders; diff --git a/matsen-tool/src/app/core/api/v1/model/contact.ts b/matsen-tool/src/app/core/api/v1/model/contact.ts index deec4b6..6ffc358 100644 --- a/matsen-tool/src/app/core/api/v1/model/contact.ts +++ b/matsen-tool/src/app/core/api/v1/model/contact.ts @@ -20,7 +20,7 @@ export interface Contact { partner?: string | null; birthday?: string | null; image?: string | null; - imageUrl?: string | null; + readonly imageUrl?: string | null; position?: string | null; phone?: string | null; email?: string | null; diff --git a/matsen-tool/src/app/core/api/v1/model/contactJsonhal.ts b/matsen-tool/src/app/core/api/v1/model/contactJsonhal.ts index 8071286..07d6527 100644 --- a/matsen-tool/src/app/core/api/v1/model/contactJsonhal.ts +++ b/matsen-tool/src/app/core/api/v1/model/contactJsonhal.ts @@ -22,7 +22,7 @@ export interface ContactJsonhal { partner?: string | null; birthday?: string | null; image?: string | null; - imageUrl?: string | null; + readonly imageUrl?: string | null; position?: string | null; phone?: string | null; email?: string | null; diff --git a/matsen-tool/src/app/core/api/v1/model/contactJsonld.ts b/matsen-tool/src/app/core/api/v1/model/contactJsonld.ts index 90be4b2..ffd9cf3 100644 --- a/matsen-tool/src/app/core/api/v1/model/contactJsonld.ts +++ b/matsen-tool/src/app/core/api/v1/model/contactJsonld.ts @@ -23,7 +23,7 @@ export interface ContactJsonld { partner?: string | null; birthday?: string | null; image?: string | null; - imageUrl?: string | null; + readonly imageUrl?: string | null; position?: string | null; phone?: string | null; email?: string | null; diff --git a/matsen-tool/src/app/core/api/v1/model/partner.ts b/matsen-tool/src/app/core/api/v1/model/partner.ts index 7675daa..7e10203 100644 --- a/matsen-tool/src/app/core/api/v1/model/partner.ts +++ b/matsen-tool/src/app/core/api/v1/model/partner.ts @@ -24,7 +24,7 @@ export interface Partner { country?: string | null; website?: string | null; logo?: string | null; - logoUrl?: string | null; + readonly logoUrl?: string | null; createdAt?: string | null; contacts?: Array; } diff --git a/matsen-tool/src/app/core/api/v1/model/partnerJsonhal.ts b/matsen-tool/src/app/core/api/v1/model/partnerJsonhal.ts index f8723b2..cbefdd4 100644 --- a/matsen-tool/src/app/core/api/v1/model/partnerJsonhal.ts +++ b/matsen-tool/src/app/core/api/v1/model/partnerJsonhal.ts @@ -26,7 +26,7 @@ export interface PartnerJsonhal { country?: string | null; website?: string | null; logo?: string | null; - logoUrl?: string | null; + readonly logoUrl?: string | null; createdAt?: string | null; contacts?: Array; } diff --git a/matsen-tool/src/app/core/api/v1/model/partnerJsonld.ts b/matsen-tool/src/app/core/api/v1/model/partnerJsonld.ts index 8072da0..02d5e0b 100644 --- a/matsen-tool/src/app/core/api/v1/model/partnerJsonld.ts +++ b/matsen-tool/src/app/core/api/v1/model/partnerJsonld.ts @@ -26,7 +26,7 @@ export interface PartnerJsonld { country?: string | null; website?: string | null; logo?: string | null; - logoUrl?: string | null; + readonly logoUrl?: string | null; createdAt?: string | null; contacts?: Array; } diff --git a/matsen-tool/src/app/core/api/v1/model/post.ts b/matsen-tool/src/app/core/api/v1/model/post.ts index d16b708..57c1f96 100644 --- a/matsen-tool/src/app/core/api/v1/model/post.ts +++ b/matsen-tool/src/app/core/api/v1/model/post.ts @@ -17,8 +17,10 @@ import { Contact } from './contact'; * */ export interface Post { + headline: string | null; message: string | null; owner?: string | null; + readonly ownerName?: string | null; partner?: Partner | null; contact?: Contact | null; readonly createdAt?: string | null; diff --git a/matsen-tool/src/app/core/api/v1/model/postJsonhal.ts b/matsen-tool/src/app/core/api/v1/model/postJsonhal.ts index 91437d3..7b8e734 100644 --- a/matsen-tool/src/app/core/api/v1/model/postJsonhal.ts +++ b/matsen-tool/src/app/core/api/v1/model/postJsonhal.ts @@ -19,8 +19,10 @@ import { PartnerJsonhal } from './partnerJsonhal'; */ export interface PostJsonhal { _links?: ContactJsonhalLinks; + headline: string | null; message: string | null; owner?: string | null; + readonly ownerName?: string | null; partner?: PartnerJsonhal | null; contact?: ContactJsonhal | null; readonly createdAt?: string | null; diff --git a/matsen-tool/src/app/core/api/v1/model/postJsonld.ts b/matsen-tool/src/app/core/api/v1/model/postJsonld.ts index f86022a..4e93f08 100644 --- a/matsen-tool/src/app/core/api/v1/model/postJsonld.ts +++ b/matsen-tool/src/app/core/api/v1/model/postJsonld.ts @@ -20,8 +20,10 @@ export interface PostJsonld { context?: string | null; readonly id?: string; readonly type?: string; + headline: string | null; message: string | null; owner?: string | null; + readonly ownerName?: string | null; partner?: PartnerJsonld | null; contact?: ContactJsonld | null; readonly createdAt?: string | null; diff --git a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html index d09aebc..281d8b6 100644 --- a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html +++ b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html @@ -130,89 +130,24 @@

Notizen

-
-
-
-
-

12.10.2023

-

Jan Hansen

-
-
-

Neues Tool nutzen

-

Immer alles hier rein schreiben!

-
-
-
- -
-
-
-
-
-

01.10.2023

-

Jan Hansen

-
-
-

Konditionen

-

Wir gewähren immer 10% Rabatt bei Bestellungen über 20.000 €.

-
-
-
-
-
-
-

02.10.2023

-

Daniel Knudsen

-
-
-

Achja! Gut zu wissen!

-
-
-
- -
-
-
-
-
-

12.09.2023

-

Florian Eisenmenger

-
-
-

Ausland - Schwer erreichbar

-

Peter Müller ist der Chef, aber schwer erreichbar. Am besten Mobil probieren!

-
-
-
-
-
-
-

04.10.2023

-

Jan Hansen

-
-
-

Leider geht er mobil selten dran. Eher E-Mails schicken!

+
+
+
+
+
+

{{ post.createdAt | date:'dd.MM.YYYY hh:mm' }}

+

{{ post.ownerName }}

+
+
+

{{ post.headline }}

+

{{ post.message }}

+
-
-
-
-
-

02.10.2023

-

Florian Eisenmenger

-
-
-

Ich habe mit FAX die besten Erfahrungen gemacht...

-
+
-
; - protected contactsDataSource; protected contactsLength: number; protected contactsPageEvent: PageEvent; protected contactsPageSize: number; protected contactsPageIndex: number; + //protected posts: Array; protected tasksDataSource; protected tasksLength: number; protected tasksPageEvent: PageEvent; protected tasksPageSize: number; protected tasksPageIndex: number; + protected postsSub: Subscription; + protected posts: Array; protected postsDataSource; protected postsLength: number; protected postsPageEvent: PageEvent; @@ -56,16 +56,15 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { private modalService: NgbModal, private route: ActivatedRoute, private partnerService: PartnerService, - private contactService: ContactService + private contactService: ContactService, + private postService: PostService ) { this.id = ""; this.partnerDetailSub = new Subscription(); this.partner = {} as PartnerJsonld; - this.partnerLogoSub = new Subscription(); - this.partnerLogo = ""; - this.partnerContactsSub = new Subscription(); - this.contacts = []; + this.contactsSub = new Subscription(); + this.contacts = []; this.contactsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); this.contactsDataSource = new MatTableDataSource(this.contacts); this.contactsLength = 0; @@ -82,6 +81,8 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { this.tasksPageIndex = 0; // TODO: Change Jsonld + this.postsSub = new Subscription(); + this.posts = []; this.postsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); this.postsDataSource = new MatTableDataSource(this.contacts); this.postsLength = 0; @@ -99,7 +100,9 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { this.route.params.subscribe(params => { this.id = params['id']; }); - this.getData(); + this.getPartnerData(); + this.getContactsData(); + this.getPostsData(); } ngAfterViewInit() { @@ -108,24 +111,41 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { this.postsDataSource.paginator = this.postsPaginator; } - getData() { + getPartnerData() { this.partnerDetailSub = this.partnerService.partnersIdGet( this.id ).subscribe( data => { this.partner = data; + } + ); + } - this.partnerContactsSub = this.contactService.contactsGetCollection( - this.contactsPageIndex + 1, - 6, - ApiConverter.extractId(this.partner.id) - ).subscribe( - data => { - this.contacts = data["hydra:member"]; - this.contactsLength = Number(data["hydra:totalItems"]); - this.contactsPaginator.length = this.contactsLength; - } - ) + getContactsData() { + this.contactsSub = this.contactService.contactsGetCollection( + this.contactsPageIndex + 1, + 6, + this.id + ).subscribe( + data => { + this.contacts = data["hydra:member"]; + this.contactsLength = Number(data["hydra:totalItems"]); + this.contactsPaginator.length = this.contactsLength; + } + ); + } + + getPostsData() { + this.postsSub = this.postService.postsGetCollection( + this.postsPageIndex + 1, + 10, + this.id + ).subscribe( + data => { + console.log(data); + this.posts = data["hydra:member"]; + this.postsLength = Number(data["hydra:totalItems"]); + this.postsPaginator.length = this.contactsLength; } ); } @@ -135,7 +155,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { this.contactsLength = e.length; this.contactsPageIndex = e.pageIndex.valueOf(); this.contactsPageSize = e.pageSize.valueOf(); - this.getData(); + this.getContactsData(); } tasksHandlePageEvent(e: PageEvent) { @@ -151,7 +171,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { this.postsLength = e.length; this.postsPageIndex = e.pageIndex.valueOf(); this.postsPageSize = e.pageSize.valueOf(); - // this.getData(); + this.getPostsData(); } navigateToContactDetails(element: any) {