doc: various

This commit is contained in:
2025-12-03 19:43:12 -07:00
parent ccc849a30f
commit d4f714d14d
5 changed files with 151 additions and 26 deletions
+82 -21
View File
@@ -17,39 +17,40 @@ Allow people to attach an emoji onto a record. The main entity to which emojis w
### 2. Database Schema Design
**New Field on `give_claim`: `emojiCount`**
- [ ] map of emoji character key to numeric count of that emoji
- [x] map of emoji character key to numeric count of that emoji
**New Table `emoji_claim`**
- [ ] Standard claim fields: `jwtId`, `issuerDid`, `issuedAt`
- [ ] Emoji-specific fields: `text`, `parentItemHandleId`
- [x] Standard claim fields: `jwtId`, `issuerDid`, `issuedAt`
- [x] Emoji-specific fields: `text`, `parentItemHandleId`
**Database Migration**
- [ ] Create new `emoji_claim` table following existing patterns
- [ ] Add `emojiCount` column to `give_claim` tables
- [ ] Indexes on `parentItemHandleId` & `issuerDid` for efficient retrieval
- [x] Create new `emoji_claim` table following existing patterns
- [x] Add `emojiCount` column to `give_claim` tables
- [x] Indexes on `parentItemHandleId` & `issuerDid` for efficient retrieval
- [x] Update sql/README.md with new schema (following development conventions)
### 3. API Endpoint Design
**Submission Endpoint:**
- [ ] `POST /api/v2/claim` (reuse existing claim submission)
- [ ] Validate Emoji contents: text, lastClaimId
- [ ] Ensure there is no "agent". (The issuer is the "agent" attaching the emojis; it doesn't make sense to attach an emoji on behalf of someone else.)
- [ ] Store in `emoji_claim` table
- [ ] Update `give_claim` `emojiCount`
- [ ] Return standard claim response with `claimId` and `handleId`
- [ ] Add to emoji count of the parent if `give_claim`
- [ ] Allow for a removal of a previous emoji: if they sent it before, it gets toggled (like in Slack) and entry in `emoji_claim` for this `issuerDid` + `parentHandleId` + `text` is erased
- [x] `POST /api/v2/claim` (reuse existing claim submission)
- [x] Validate Emoji contents: text, lastClaimId
- [x] Ensure there is no "agent". (The issuer is the "agent" attaching the emojis; it doesn't make sense to attach an emoji on behalf of someone else.)
- [x] Store in `emoji_claim` table
- [x] Update `give_claim` `emojiCount`
- [x] Return standard claim response with `claimId` and `handleId`
- [x] Add to emoji count of the parent if `give_claim`
- [x] Allow for a removal of a previous emoji: if they sent it before, it gets toggled (like in Slack) and entry in `emoji_claim` for this `issuerDid` + `parentHandleId` + `text` is erased
**New Retrieval Endpoints:**
- [ ] `GET /api/v2/report/emoji?parentHandleId=<handleId>` gets all active `emoji_claim` records for an item, paged
- [x] `GET /api/v2/report/emoji?parentHandleId=<handleId>` gets all active `emoji_claim` records for an item, paged
**Modify existing endpoints:**
- [ ] Update `dbService.getGives*` methods to include emoji counts
- [ ] Update types and API documentation
- [x] Update `dbService.getGives*` methods to include emoji counts
- [x] Update types and API documentation
**API Documentation**
- [ ] Update Swagger documentation for new endpoints
- [ ] Document Emoji claim structure
- [ ] Provide examples of emoji submission and retrieval
- [x] Update Swagger documentation for new endpoints
- [x] Document Emoji claim structure
- [x] Provide examples of emoji submission and retrieval
**Authentication & Authorization**
- Emojis require valid JWT authentication (like other claims)
@@ -57,7 +58,7 @@ Allow people to attach an emoji onto a record. The main entity to which emojis w
- Users can retrieve all emoji taggers on a particular GiveAction, though DIDs are subject to visibility constraints
**Test**
- [ ] Write tests for each case on the back end (multiple emojis, removal, etc) in a new test file
- [x] Write tests for each case on the back end (multiple emojis, removal, etc) in a new test file
### 5. Client-Side
**Add to UI**
@@ -67,6 +68,66 @@ Allow people to attach an emoji onto a record. The main entity to which emojis w
- [ ] Show the previous emojis with their count, with data from GiveSummaryRecord
- [ ] Clicking on an emoji already sent from this person removes it
**Sample of emoji-mart-vue-fast***
We expect the emoji-mart-vue-fast library will be the best one to allow users to choose an emoji. Here is exsample usage:
```
<template>
<div class="row">
<Picker :data="emojiIndex" set="twitter" @select="showEmoji" />
</div>
<div class="row">
<div>
{{ emojisOutput }}
</div>
</div>
</template>
<script>
// Import data/twitter.json to reduce size, all.json contains data for
// all emoji sets.
import data from "emoji-mart-vue-fast/data/all.json";
// Import default CSS
import "emoji-mart-vue-fast/css/emoji-mart.css";
// Vue 2:
import { Picker, EmojiIndex } from "emoji-mart-vue-fast";
// Vue 3, import components from `/src`:
import { Picker, EmojiIndex } from "emoji-mart-vue-fast/src";
// Create emoji data index.
// We can change it (for example, filter by category) before passing to the component.
let emojiIndex = new EmojiIndex(data);
export default {
name: "App",
components: {
Picker
},
data() {
return {
emojiIndex: emojiIndex,
emojisOutput: ""
};
},
methods: {
showEmoji(emoji) {
this.emojisOutput = this.emojisOutput + emoji.native;
}
}
};
</script>
<style>
.row { display: flex; }
.row > * { margin: auto; }
</style>
```
**New TypeScript Interfaces:**
- [ ] New type send to server:
```typescript