fix: conflict

This commit is contained in:
Aslam H
2024-09-28 19:53:32 +07:00
205 changed files with 8806 additions and 2121 deletions

View File

@@ -8,67 +8,81 @@
// 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"
import { CoMap, co, Account, Profile } from 'jazz-tools'
import { PersonalPageLists } from './personal-page'
import { PersonalLinkLists } from './personal-link'
import { ListOfTopics } from './master/topic'
import { ListOfTasks } from './tasks'
import { JournalEntryLists } from './journal'
declare module 'jazz-tools' {
interface Profile {
avatarUrl?: string
}
}
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
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)
personalLinks = co.ref(PersonalLinkLists)
personalPages = co.ref(PersonalPageLists)
topicsWantToLearn = co.ref(ListOfTopics)
topicsLearning = co.ref(ListOfTopics)
topicsLearned = co.ref(ListOfTopics)
topicsWantToLearn = co.ref(ListOfTopics)
topicsLearning = co.ref(ListOfTopics)
topicsLearned = co.ref(ListOfTopics)
// TODO: maybe should be in another place?
connectedFolderPath = co.optional.string
tasks = co.ref(ListOfTasks)
journalEntries = co.ref(JournalEntryLists)
// TODO: maybe should be in another place?
connectedFolderPath = co.optional.string
}
export class LaAccount extends Account {
profile = co.ref(Profile)
root = co.ref(UserRoot)
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)
migrate(
this: LaAccount,
creationProps?: { name: string; avatarUrl?: 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)
console.log("In migration", this._refs.root, creationProps)
if (!this._refs.root && creationProps) {
this.root = UserRoot.create(
{
name: creationProps.name,
username: creationProps.name,
avatar: creationProps.avatarUrl || '',
website: '',
bio: '',
is_public: false,
if (!this._refs.root && creationProps) {
this.root = UserRoot.create(
{
name: creationProps.name,
username: creationProps.name,
avatar: "",
website: "",
bio: "",
is_public: false,
connectedFolderPath: '',
connectedFolderPath: "",
personalLinks: PersonalLinkLists.create([], { owner: this }),
personalPages: PersonalPageLists.create([], { owner: this }),
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 }),
topicsWantToLearn: ListOfTopics.create([], { owner: this }),
topicsLearning: ListOfTopics.create([], { owner: this }),
topicsLearned: ListOfTopics.create([], { owner: this })
},
{ owner: this }
)
}
}
tasks: ListOfTasks.create([], { owner: this }),
journalEntries: JournalEntryLists.create([], { owner: this })
},
{ owner: this }
)
}
}
}
export * from "./master/topic"
export * from "./personal-link"
export * from "./personal-page"
export * from './master/topic'
export * from './personal-link'
export * from './personal-page'

11
web/lib/schema/journal.ts Normal file
View File

@@ -0,0 +1,11 @@
import { co, CoList, CoMap, Encoders } from "jazz-tools"
export class JournalEntry extends CoMap {
title = co.string
content = co.json()
date = co.encoded(Encoders.Date)
createdAt = co.encoded(Encoders.Date)
updatedAt = co.encoded(Encoders.Date)
}
export class JournalEntryLists extends CoList.Of(co.ref(JournalEntry)) {}

11
web/lib/schema/tasks.ts Normal file
View File

@@ -0,0 +1,11 @@
import { co, CoList, CoMap, Encoders } from "jazz-tools"
export class Task extends CoMap {
title = co.string
description = co.optional.string
status = co.literal("todo", "in_progress", "done")
createdAt = co.encoded(Encoders.Date)
updatedAt = co.encoded(Encoders.Date)
}
export class ListOfTasks extends CoList.Of(co.ref(Task)) {}