@christianriedl/media 1.0.170 → 1.0.171

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,14 +7,15 @@ export declare class BooksService implements IBooksService {
7
7
  mediaUrl: string;
8
8
  user: string;
9
9
  log: ILogger;
10
+ cachedAuthors?: IAuthorShort[];
10
11
  constructor(rest: IRest, user: string, statistics: IStatistics, log: ILogger);
11
12
  getAuthors(surName?: string, givenName?: string, withBooks?: boolean, id?: number): Promise<IAuthor[]>;
12
13
  getAuthorsShort(): Promise<IAuthorShort[]>;
13
- addAuthor(author: IAuthor): Promise<boolean>;
14
+ addAuthor(author: IAuthor): Promise<number>;
14
15
  updateAuthor(author: IAuthor): Promise<boolean>;
15
16
  deleteAuthor(id: number): Promise<boolean>;
16
17
  getBooks(authorId?: number, bookId?: number): Promise<IBook[]>;
17
- addBook(book: IBook): Promise<boolean>;
18
+ addBook(book: IBook): Promise<number>;
18
19
  updateBook(book: IBook): Promise<boolean>;
19
20
  deleteBook(id: number): Promise<boolean>;
20
21
  }
@@ -4,6 +4,7 @@ export class BooksService {
4
4
  mediaUrl;
5
5
  user;
6
6
  log;
7
+ cachedAuthors;
7
8
  constructor(rest, user, statistics, log) {
8
9
  this.log = log;
9
10
  this.rest = rest;
@@ -15,22 +16,30 @@ export class BooksService {
15
16
  return info.result;
16
17
  }
17
18
  async getAuthorsShort() {
18
- const info = await this.rest.getData('apibooks/authors/short');
19
- return info.result;
19
+ if (!this.cachedAuthors) {
20
+ const info = await this.rest.getData('apibooks/authors/short');
21
+ this.cachedAuthors = info.result;
22
+ }
23
+ return this.cachedAuthors;
20
24
  }
21
25
  async addAuthor(author) {
22
26
  const url = `apibooks/authors`;
23
- const res = await this.rest.postData(url, author);
27
+ const res = await this.rest.postDataEx(url, author);
28
+ this.cachedAuthors = undefined;
29
+ this.log.info(`Add author ${author.surName} : ${res.result}`);
24
30
  return res.result;
25
31
  }
26
32
  async updateAuthor(author) {
27
33
  const url = `apibooks/authors`;
28
34
  const res = await this.rest.putData(url, author);
35
+ this.log.info(`Update author ${author.surName} : ${res.result}`);
29
36
  return res.result;
30
37
  }
31
38
  async deleteAuthor(id) {
32
39
  const url = `apibooks/authors?id=${id}`;
33
40
  const res = await this.rest.deleteData(url);
41
+ this.cachedAuthors = undefined;
42
+ this.log.info(`Delete author ${id} : ${res.result}`);
34
43
  return res.result;
35
44
  }
36
45
  async getBooks(authorId, bookId) {
@@ -39,17 +48,20 @@ export class BooksService {
39
48
  }
40
49
  async addBook(book) {
41
50
  const url = `apibooks/books`;
42
- const res = await this.rest.postData(url, book);
51
+ const res = await this.rest.postDataEx(url, book);
52
+ this.log.info(`Add book ${book.title} : ${res.result}`);
43
53
  return res.result;
44
54
  }
45
55
  async updateBook(book) {
46
56
  const url = `apibooks/books`;
47
57
  const res = await this.rest.putData(url, book);
58
+ this.log.info(`Update book ${book.title} : ${res.result}`);
48
59
  return res.result;
49
60
  }
50
61
  async deleteBook(id) {
51
62
  const url = `apibooks/books?id=${id}`;
52
63
  const res = await this.rest.deleteData(url);
64
+ this.log.info(`Add book ${id} : ${res.result}`);
53
65
  return res.result;
54
66
  }
55
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"booksService.js","sourceRoot":"","sources":["../src/booksService.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,cAAc,GAAqC,MAAM,CAAC,WAAW,CAAC,CAAC;AACpF,MAAM,OAAO,YAAY;IACrB,IAAI,CAAQ;IACZ,QAAQ,CAAS;IACjB,IAAI,CAAS;IACb,GAAG,CAAU;IACb,YAAY,IAAW,EAAE,IAAY,EAAE,UAAuB,EAAE,GAAY;QACxE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IA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AM,EAAE,CAAC,CAAA;QAC1D,OAAO,GAAG,CAAC,MAAiB,CAAC;IACjC,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,EAAU;QACvB,MAAM,GAAG,GAAG,qBAAqB,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAmB,GAAG,CAAC,CAAC;QAC9D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,CAAA;QAC/C,OAAO,GAAG,CAAC,MAAiB,CAAC;IACjC,CAAC;CACJ"}
package/dist/iBooks.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- export interface IBookKey {
2
- id: number;
3
- value: string;
4
- }
5
1
  export interface IAuthor {
6
2
  id: number;
7
3
  surName: string;
@@ -9,7 +5,7 @@ export interface IAuthor {
9
5
  yearOfBirth: number;
10
6
  yearOfDeath?: number;
11
7
  country?: string;
12
- books?: IBookKey[];
8
+ books?: IBook[];
13
9
  }
14
10
  export interface IAuthorShort {
15
11
  id: number;
@@ -28,11 +24,11 @@ export interface IBook {
28
24
  export interface IBooksService {
29
25
  getAuthors(surName?: string, givenName?: string, withBooks?: boolean, id?: number): Promise<IAuthor[]>;
30
26
  getAuthorsShort(): Promise<IAuthorShort[]>;
31
- addAuthor(author: IAuthor): Promise<boolean>;
27
+ addAuthor(author: IAuthor): Promise<number>;
32
28
  updateAuthor(author: IAuthor): Promise<boolean>;
33
29
  deleteAuthor(id: number): Promise<boolean>;
34
30
  getBooks(authorId?: number, bookId?: number): Promise<IBook[]>;
35
- addBook(book: IBook): Promise<boolean>;
31
+ addBook(book: IBook): Promise<number>;
36
32
  updateBook(book: IBook): Promise<boolean>;
37
33
  deleteBook(id: number): Promise<boolean>;
38
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/media",
3
- "version": "1.0.170",
3
+ "version": "1.0.171",
4
4
  "description": "RIC media interfaces",
5
5
 
6
6
  "main": "dist/index.js",
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch, StyleValue } from 'vue';upload
2
+ import { inject, ref, reactive, computed, onMounted, onUnmounted, nextTick, watch, StyleValue } from 'vue';
3
3
  import type { ComponentPublicInstance } from 'vue';
4
4
  import { useRouter } from 'vue-router';
5
5
  import { IAppState, Helper, EDevice, EScope, appStateSymbol, IAppConfig, appConfigSymbol } from '@christianriedl/utils';