-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2824 from SeedCompany/improve-dynamic-resources
- Loading branch information
Showing
7 changed files
with
72 additions
and
22 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
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,15 +1,32 @@ | ||
import { InterfaceType } from '@nestjs/graphql'; | ||
import { stripIndent } from 'common-tags'; | ||
import { ID, IdField } from '../../../common'; | ||
import { keys as keysOf } from 'ts-transformer-keys'; | ||
import { ID, IdField, SecuredProps } from '~/common'; | ||
import { RegisterResource } from '~/core/resources'; | ||
import { Post } from './post.dto'; | ||
|
||
@RegisterResource() | ||
@InterfaceType({ | ||
description: stripIndent` | ||
An object that can be used to enable Post discussions on a Node. | ||
`, | ||
}) | ||
export abstract class Postable { | ||
static readonly Props: string[] = keysOf<Postable>(); | ||
static readonly SecuredProps: string[] = keysOf<SecuredProps<Postable>>(); | ||
static readonly Relations = { | ||
posts: [Post], | ||
}; | ||
static readonly Parent = 'dynamic'; | ||
|
||
@IdField({ | ||
description: "The object's ID", | ||
}) | ||
readonly id: ID; | ||
} | ||
|
||
declare module '~/core/resources/map' { | ||
interface ResourceMap { | ||
Postable: typeof Postable; | ||
} | ||
} |
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