Skip to content

Commit

Permalink
Merge pull request #90 from amplication/amplication-amplication-blog
Browse files Browse the repository at this point in the history
chore(Amplication): Update Generated Code
  • Loading branch information
yuval-hazaz authored Dec 24, 2023
2 parents b9ccdda + 6d924f1 commit 38a55d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 43 deletions.
12 changes: 0 additions & 12 deletions server/src/grants.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@
"action": "delete:any",
"attributes": "*"
},
{
"role": "user",
"resource": "Story",
"action": "read:own",
"attributes": "*"
},
{
"role": "user",
"resource": "Story",
Expand All @@ -106,11 +100,5 @@
"resource": "Story",
"action": "delete:any",
"attributes": "*"
},
{
"role": "user",
"resource": "Story",
"action": "read:any",
"attributes": "*"
}
]
16 changes: 3 additions & 13 deletions server/src/story/base/story.controller.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as nestAccessControl from "nest-access-control";
import * as defaultAuthGuard from "../../auth/defaultAuth.guard";
import { StoryService } from "../story.service";
import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor";
import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor";
import { Public } from "../../decorators/public.decorator";
import { StoryCreateInput } from "./StoryCreateInput";
import { Story } from "./Story";
import { Post } from "../../post/base/Post";
Expand Down Expand Up @@ -66,15 +66,10 @@ export class StoryControllerBase {
});
}

@common.UseInterceptors(AclFilterResponseInterceptor)
@Public()
@common.Get()
@swagger.ApiOkResponse({ type: [Story] })
@ApiNestedQuery(StoryFindManyArgs)
@nestAccessControl.UseRoles({
resource: "Story",
action: "read",
possession: "any",
})
@swagger.ApiForbiddenResponse({
type: errors.ForbiddenException,
})
Expand All @@ -99,15 +94,10 @@ export class StoryControllerBase {
});
}

@common.UseInterceptors(AclFilterResponseInterceptor)
@Public()
@common.Get("/:id")
@swagger.ApiOkResponse({ type: Story })
@swagger.ApiNotFoundResponse({ type: errors.NotFoundException })
@nestAccessControl.UseRoles({
resource: "Story",
action: "read",
possession: "own",
})
@swagger.ApiForbiddenResponse({
type: errors.ForbiddenException,
})
Expand Down
22 changes: 4 additions & 18 deletions server/src/story/base/story.resolver.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as nestAccessControl from "nest-access-control";
import * as gqlACGuard from "../../auth/gqlAC.guard";
import { GqlDefaultAuthGuard } from "../../auth/gqlDefaultAuth.guard";
import * as common from "@nestjs/common";
import { AclFilterResponseInterceptor } from "../../interceptors/aclFilterResponse.interceptor";
import { Public } from "../../decorators/public.decorator";
import { AclValidateRequestInterceptor } from "../../interceptors/aclValidateRequest.interceptor";
import { Story } from "./Story";
import { StoryCountArgs } from "./StoryCountArgs";
Expand All @@ -35,12 +35,8 @@ export class StoryResolverBase {
protected readonly rolesBuilder: nestAccessControl.RolesBuilder
) {}

@Public()
@graphql.Query(() => MetaQueryPayload)
@nestAccessControl.UseRoles({
resource: "Story",
action: "read",
possession: "any",
})
async _storiesMeta(
@graphql.Args() args: StoryCountArgs
): Promise<MetaQueryPayload> {
Expand All @@ -50,24 +46,14 @@ export class StoryResolverBase {
};
}

@common.UseInterceptors(AclFilterResponseInterceptor)
@Public()
@graphql.Query(() => [Story])
@nestAccessControl.UseRoles({
resource: "Story",
action: "read",
possession: "any",
})
async stories(@graphql.Args() args: StoryFindManyArgs): Promise<Story[]> {
return this.service.stories(args);
}

@common.UseInterceptors(AclFilterResponseInterceptor)
@Public()
@graphql.Query(() => Story, { nullable: true })
@nestAccessControl.UseRoles({
resource: "Story",
action: "read",
possession: "own",
})
async story(
@graphql.Args() args: StoryFindUniqueArgs
): Promise<Story | null> {
Expand Down

0 comments on commit 38a55d0

Please sign in to comment.