Files
archived-linsa/web/lib/schema/index.ts
Aslam 9e89959dd4 fix: detail topic (#117)
* feat: keyboard nav

* fix: link update

* feat: reusable learning state

* chore: use new learning state

* feat: add to my profile

* .

* .

* feat: on enter open the link

* fix: lint

* fix: use eslint v8 instead of v9

* fix: add to my profile

* chore: update personal link schema

* chore: update personal page schema

* fix: update detail wrapper

* fix: update page section

* removing option for learning status

* removing option for learning status for topic

* feat: add createdAt and updatedAt for personal Page

* chore: update page section component

* chore: remove chevron from sub menu

* fix: sidebar

* chore: add focus and disable toast

* feat: la editor add execption for no command class

* fix: la editor style and fix page detail

* fix: title

* fix: topic learning state

* chore: add showSearch for learning state

* fix: bunch stuff

* chore: link list and item handle learning state

* chore: set expand to false

* feat: personal link for topic detail

* chore: hook use topic data

* chore: go to list

* fix: link and topic

* feat(utils): new keyboard utils

* feat(store): add linkOpenPopoverForIdAtom for link

* chore: using memo for use topic data

* fix: remove duplicate component

* chore: performance for topic detail lint item

* refactor: remove LinkOptions component

* chore: improve performance for list

* feat: added LinkRoute copmonent

* chore: link manage

* feat: bottom bar

* fix: link

* fix: page wrapper

* fix: import thing

* chore: added a displayname

* refactor: page detail

* refactor: page detail

* fix: add topic to personal link form link

* fix: only show page count if more than zero

* fix: sidebar topic section

---------

Co-authored-by: Nikita <github@nikiv.dev>
Co-authored-by: marshennikovaolga <marshennikova@gmail.com>
2024-08-29 02:48:48 +07:00

68 lines
2.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Jazz schema for LA
// if field does not have `co.optional` it is required
// rule: list all required fields first, then optional fields
// rule: any field that is generated by AI, should be prefixed with `ai`, e.g. `aiSummary`
// TODO: move more fields from old edgedb schema to jazz (where it makes sense): https://github.com/learn-anything/explore/blob/main/archive/api/edgedb/dbschema/default-latest.esdl
// TODO: all instances of (unique) should be enforced by jazz itself, it means that only one instance with that name of field can exist
// sadly jazz does not allow enforcing that, so solutions for (unique) fields is: ignore duplicates or create a supporting look up structure (CoMap.Record from url to GlobalLink) and then Ill let you know once the better way exists
// open issue about it: https://github.com/gardencmp/jazz/issues/44
// TODO: figure out how to do default values, e.g. `GlobalLink.protocol` should have default value `https` so we don't have to supply it every time in code..
// TODO: can jazz support vector fields? e.g. `GlobalLinkAiSummary.vectorContent`, would be nice to store website content as vector for semantic search
import { CoMap, co, Account, Profile } from "jazz-tools"
import { PersonalPageLists } from "./personal-page"
import { PersonalLinkLists } from "./personal-link"
import { ListOfTopics } from "./master/topic"
export class UserRoot extends CoMap {
name = co.string
username = co.string
avatar = co.optional.string
website = co.optional.string
bio = co.optional.string
is_public = co.optional.boolean
personalLinks = co.ref(PersonalLinkLists)
personalPages = co.ref(PersonalPageLists)
topicsWantToLearn = co.ref(ListOfTopics)
topicsLearning = co.ref(ListOfTopics)
topicsLearned = co.ref(ListOfTopics)
}
export class LaAccount extends Account {
profile = co.ref(Profile)
root = co.ref(UserRoot)
migrate(this: LaAccount, creationProps?: { name: string }) {
// since we dont have a custom AuthProvider yet.
// and still using the DemoAuth. the creationProps will only accept name.
// so just do default profile create provided by jazz-tools
super.migrate(creationProps)
if (!this._refs.root && creationProps) {
this.root = UserRoot.create(
{
name: creationProps.name,
username: creationProps.name,
avatar: "",
website: "",
bio: "",
is_public: false,
personalLinks: PersonalLinkLists.create([], { owner: this }),
personalPages: PersonalPageLists.create([], { owner: this }),
topicsWantToLearn: ListOfTopics.create([], { owner: this }),
topicsLearning: ListOfTopics.create([], { owner: this }),
topicsLearned: ListOfTopics.create([], { owner: this })
},
{ owner: this }
)
}
}
}
export * from "./master/topic"
export * from "./personal-link"
export * from "./personal-page"