dappros / ethora

A 'super app' engine for your project. React Native (iOS, Android) and React.js (Web, desktop). Social Sign In 🄵, Messaging 💬 (chat, voice, push notifications), Web3 Wallet 🪪 (profile QR, documents, coins, NFT), DLT 🔐 (provenance, crypto signing), Gamification 🤩, Social Commerce and more.
https://ethora.com/
GNU Affero General Public License v3.0
400 stars 74 forks source link

API - default Rooms setting and endpoint #475

Closed phwizard closed 11 months ago

phwizard commented 11 months ago

Default Rooms and "Pinned' flag are needed to manage the default chat rooms and their pinned status at the Application level.

There can be from 0 to 3 default rooms for each Applicaiton.

When a new Application is created, its default rooms settings should be populated with Server-level Default Rooms (can be taken from .env file).

Example of .env file for Server level default rooms:

defaultRooms[0]['title']='Random talks'; defaultRooms[0]['address']='5dc237d5792e95ba96240223e14ee00b13d2548c5cdfcf2e27ca67a0b11f5b9d'; defaultRooms[0]['pinned']=true; defaultRooms[1]['title']='Technical support'; defaultRooms[1]['address']='cc39004bf432f6dc34b47cd64251236c9ae65eadd890daef3ff7dbc94c3caecb'; defaultRooms[1]['pinned']=true; defaultRooms[2]['title']='NFT Factory'; defaultRooms[2]['address']='dc635d74fb77f53701d48899d86175c3a62a3e8a2a76e9f5ea0e9a3918cf6152'; defaultRooms[1]['pinned']=true;

API endpoints need to be implemented to allow:

In the frontend (Admin) we already have the UI for this but the app owner / admin cannot edit (write) to these settings.

The above changes are needed to complete this implementation.

Screenshot 2023-07-27 at 15 43 58
phwizard commented 11 months ago

Clarification (user story)

We should have default rooms at server level, specified in .env file.

There will be API endpoint such as chat/defaultrooms or something like that that should return 3 default rooms.

If in DB for current App there are no defaultRooms records for this current App then the API returns the rooms from server-wide .env file.

If there are local App-level settings in DB, then API returns rooms from the DB as set for this app.

As soon as App Owner decide they want to change the default rooms, they simply go to App Settings web UI and update settings there with Title, JID and Pinned status for up to 3 new rooms.

As soon as new rooms are saved (can also be via /chat/defaultrooms - post method?) then DB records for current app are created and both the client app and the web admin will be reading the new settings, and not the server-wide settings anymore.

Bhorshrm commented 11 months ago

Hi @phwizard , I am interested in contributing to this issue. Can you please give me some idea as to which file can I find on the above webpage for user settings? Also, where can I find /chat/defaultrooms - post method API and file where JWT token auth mech has been implemented. And also a general overview would be much appreciated about the DB files as well.