-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(infra): doc properties by orm (#8382)
create new orm table docConfiguration move primary store to docConfiguration
- Loading branch information
Showing
16 changed files
with
551 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export { AFFiNE_WORKSPACE_DB_SCHEMA } from './schema'; | ||
export type { DocProperties } from './schema'; | ||
export { | ||
AFFiNE_WORKSPACE_DB_SCHEMA, | ||
AFFiNE_WORKSPACE_USERDATA_DB_SCHEMA, | ||
} from './schema'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/common/infra/src/modules/doc/entities/property-list.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Entity } from '../../../framework'; | ||
import { LiveData } from '../../../livedata'; | ||
import type { DocCustomPropertyInfo } from '../../db/schema/schema'; | ||
import type { DocPropertiesStore } from '../stores/doc-properties'; | ||
|
||
export class DocPropertyList extends Entity { | ||
constructor(private readonly docPropertiesStore: DocPropertiesStore) { | ||
super(); | ||
} | ||
|
||
properties$ = LiveData.from( | ||
this.docPropertiesStore.watchDocPropertyInfoList(), | ||
[] | ||
); | ||
|
||
updatePropertyInfo(id: string, properties: Partial<DocCustomPropertyInfo>) { | ||
this.docPropertiesStore.updateDocPropertyInfo(id, properties); | ||
} | ||
|
||
createProperty(properties: DocCustomPropertyInfo) { | ||
return this.docPropertiesStore.createDocPropertyInfo(properties); | ||
} | ||
|
||
removeProperty(id: string) { | ||
this.docPropertiesStore.removeDocPropertyInfo(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.