From e5204104f9fde1676fbdfd4a26ccf5bd198e845c Mon Sep 17 00:00:00 2001 From: griest024 Date: Mon, 7 Oct 2024 10:21:55 -0400 Subject: [PATCH] feat(driver): add base in-memory driver (#3147) --- libs/driver/in-memory/src/driver/base.class.ts | 16 ++++++++++++++++ libs/driver/in-memory/src/driver/public_api.ts | 1 + libs/driver/in-memory/src/public_api.ts | 1 + 3 files changed, 18 insertions(+) create mode 100644 libs/driver/in-memory/src/driver/base.class.ts create mode 100644 libs/driver/in-memory/src/driver/public_api.ts diff --git a/libs/driver/in-memory/src/driver/base.class.ts b/libs/driver/in-memory/src/driver/base.class.ts new file mode 100644 index 0000000000..c246b06838 --- /dev/null +++ b/libs/driver/in-memory/src/driver/base.class.ts @@ -0,0 +1,16 @@ +import { InMemoryBackendConfigArgs } from 'angular-in-memory-web-api'; + +/** + * The base class for in-memory drivers. + */ +export abstract class DaffInMemoryDriverBase { + /** + * The URL of the corresponding backend. + */ + protected readonly url = `/${this.config.apiBase}/${this.collectionName}`; + + constructor( + private config: InMemoryBackendConfigArgs, + private collectionName: string, + ) {} +} diff --git a/libs/driver/in-memory/src/driver/public_api.ts b/libs/driver/in-memory/src/driver/public_api.ts new file mode 100644 index 0000000000..06c440cd46 --- /dev/null +++ b/libs/driver/in-memory/src/driver/public_api.ts @@ -0,0 +1 @@ +export * from './base.class'; diff --git a/libs/driver/in-memory/src/public_api.ts b/libs/driver/in-memory/src/public_api.ts index 9717fb0f44..531afc737b 100644 --- a/libs/driver/in-memory/src/public_api.ts +++ b/libs/driver/in-memory/src/public_api.ts @@ -1 +1,2 @@ export * from './backend/public_api'; +export * from './driver/public_api';