2024-04-13 07:07:37 +00:00
|
|
|
import {
|
|
|
|
AccountRole,
|
|
|
|
type Class,
|
|
|
|
type IndexingConfiguration,
|
|
|
|
type Doc,
|
|
|
|
type Domain,
|
|
|
|
type Ref
|
|
|
|
} from '@hcengineering/core'
|
2024-02-23 08:39:49 +00:00
|
|
|
import { type PublicLink, type Restrictions, guestAccountEmail } from '@hcengineering/guest'
|
|
|
|
import { type Builder, Model } from '@hcengineering/model'
|
|
|
|
import core, { TDoc } from '@hcengineering/model-core'
|
|
|
|
import { type Location } from '@hcengineering/ui'
|
|
|
|
import guest from './plugin'
|
|
|
|
|
2024-06-28 03:55:32 +00:00
|
|
|
export const GUEST_DOMAIN = 'guest' as Domain
|
2024-02-23 08:39:49 +00:00
|
|
|
|
|
|
|
@Model(guest.class.PublicLink, core.class.Doc, GUEST_DOMAIN)
|
|
|
|
export class TPublicLink extends TDoc implements PublicLink {
|
|
|
|
url!: string
|
|
|
|
location!: Location
|
|
|
|
restrictions!: Restrictions
|
|
|
|
revokable!: boolean
|
|
|
|
attachedTo!: Ref<Doc>
|
|
|
|
}
|
|
|
|
|
|
|
|
export function createModel (builder: Builder): void {
|
|
|
|
builder.createModel(TPublicLink)
|
|
|
|
|
|
|
|
builder.createDoc(
|
|
|
|
core.class.Account,
|
|
|
|
core.space.Model,
|
|
|
|
{
|
|
|
|
email: guestAccountEmail,
|
2024-05-08 09:41:44 +00:00
|
|
|
role: AccountRole.DocGuest
|
2024-02-23 08:39:49 +00:00
|
|
|
},
|
|
|
|
guest.account.Guest
|
|
|
|
)
|
2024-04-12 05:23:32 +00:00
|
|
|
builder.createDoc(core.class.DomainIndexConfiguration, core.space.Model, {
|
|
|
|
domain: GUEST_DOMAIN,
|
|
|
|
disabled: [
|
|
|
|
{ createdOn: -1 },
|
|
|
|
{ space: 1 },
|
|
|
|
{ modifiedBy: 1 },
|
|
|
|
{ createdBy: 1 },
|
|
|
|
{ attachedToClass: 1 },
|
|
|
|
{ createdOn: -1 }
|
|
|
|
]
|
|
|
|
})
|
2024-04-13 07:07:37 +00:00
|
|
|
builder.mixin<Class<PublicLink>, IndexingConfiguration<PublicLink>>(
|
|
|
|
guest.class.PublicLink,
|
|
|
|
core.class.Class,
|
|
|
|
core.mixin.IndexConfiguration,
|
|
|
|
{
|
2024-04-15 12:43:39 +00:00
|
|
|
searchDisabled: true,
|
|
|
|
indexes: []
|
2024-04-13 07:07:37 +00:00
|
|
|
}
|
|
|
|
)
|
2024-02-23 08:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export { guestId } from '@hcengineering/guest'
|
|
|
|
export * from './migration'
|
|
|
|
export * from './utils'
|