Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service(s) Creation #16

Open
3 of 10 tasks
DavidBlaa opened this issue Nov 10, 2023 · 0 comments
Open
3 of 10 tasks

Service(s) Creation #16

DavidBlaa opened this issue Nov 10, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@DavidBlaa
Copy link
Member

DavidBlaa commented Nov 10, 2023

There should be a central place/file that contains all necessary functionalities (i.e. CRUD support). This should/could be similar to the implementations within the other BEXIS2 UI projects. In general, each of those projects contain several Service.ts files which contain/implement that functions. Please check out some of that projects to get an idea of "how to implement it...".

BEXIS2 Web Shell UI Services - within the directory, you will find services related to settings and versions (for different website parts - database, workspace, site).

In your case, the service class should implement all necessary functions related to entries and notes. Also, it makes much more sense to get started with the creation and continue with retrieval and deletion. Otherwise, you would need to mock existing entries to get/retrieve them. But in general, the services need to contain/support the following methods/functions:

Entry

  • get (all) entries
  • get an entry by its identifier
  • add/create an entry
  • update an entry
  • delete/remove an entry

Note

  • get (all) notes
  • get (all) notes that belong to a specific entry (get notes by its entry identifier)
  • add a note
  • update a note
  • delete/remove a note

e.g., messageStore.update((storedMessages: Message[]) => [...storedMessages, newMessage]); -> move to central file

In addition, please choose and use appropriate parameters for the different implementations. E.g., there could be support of primitive parameters (int, string,...) or complex objects.

@DavidBlaa DavidBlaa added the enhancement New feature or request label Nov 10, 2023
@sventhiel sventhiel changed the title Create a service .ts and collect all functions there Service(s) Creation Nov 10, 2023
TitoPrausee added a commit that referenced this issue Nov 23, 2023
…ing its functionality for both users and curators. Notable changes include the ability to create, retrieve, update, and delete chat entries using a backend API. Local data storage has been implemented to handle scenarios where the API is inaccessible, ensuring a seamless experience for users.

#16

1. **API Integration:**
   - The `ChatService` module now supports creating, retrieving, updating, and deleting chat entries through API calls.
   - The `fetchEntryById` function has been added to fetch entry details by ID.

2. **EntryService Updates:**
   - The `EntryService` module includes functions for creating, retrieving, updating, and deleting entries, offering a comprehensive set of operations.
   - The `createEntry` function now accepts `userId` and `curatorId` as parameters, associating them with the created entry.

3. **User and Curator Chat Components:**
   - Both the UserChat and CuratorChat Svelte components have been updated to showcase the new functionality.
   - The UserChat component demonstrates creating a new message and fetching an entry by ID.
   - The CuratorChat component illustrates updating an existing entry after fetching its details.

4. **Local Data Storage:**
   - A `LocalStorageService` has been introduced to handle local data storage operations.
   - When the API is unreachable, the `createEntry` function stores data locally, ensuring a smooth user experience.

5. **EntryModel Updates:**
   - The `EntryModel` in entryModels.ts now includes `userId` and `curatorId` properties.

6. **Code Internationalization:**
   - All code files, including entryModels.ts, EntryService.ts, ChatService.ts, and LocalStorageService.ts, now contain English comments to facilitate international understanding.

7. **Testing:**
   - The changes have been thoroughly tested to ensure proper functionality and error handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants