Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role Level Auth on InputType #220

Open
SOG-web opened this issue Aug 31, 2024 · 0 comments
Open

Role Level Auth on InputType #220

SOG-web opened this issue Aug 31, 2024 · 0 comments

Comments

@SOG-web
Copy link

SOG-web commented Aug 31, 2024

how to I add a role base level auth to this input type and arg type

let say i want my users to only be able to fetch where with only userId

@ArgsType()
export class FindUniqueOrderArgs {
  @Field(() => OrderWhereUniqueInput, { nullable: false })
  @Type(() => OrderWhereUniqueInput)
  where!: Prisma.AtLeast<OrderWhereUniqueInput, 'id'>;
}

@InputType()
export class OrderWhereUniqueInput {

    @HideField()
    id?: string;

    @Field(() => [OrderWhereInput], {nullable:true})
    AND?: Array<OrderWhereInput>;

    @Field(() => [OrderWhereInput], {nullable:true})
    OR?: Array<OrderWhereInput>;

    @Field(() => [OrderWhereInput], {nullable:true})
    NOT?: Array<OrderWhereInput>;

    @Field(() => StringFilter, {nullable:true})
    name?: StringFilter;

    @Field(() => StringNullableFilter, {nullable:true})
    userId?: StringNullableFilter;

    @Field(() => JsonFilter, {nullable:true})
    extras?: JsonFilter;

    @Field(() => EnumOrderStatusFilter, {nullable:true})
    status?: EnumOrderStatusFilter;

    @Field(() => FloatFilter, {nullable:true})
    charges?: FloatFilter;

    @Field(() => FloatFilter, {nullable:true})
    subTotal?: FloatFilter;

    @Field(() => FloatFilter, {nullable:true})
    total?: FloatFilter;

    @Field(() => EnumOrderTypeFilter, {nullable:true})
    orderType?: EnumOrderTypeFilter;

    @Field(() => EnumPaymentMethodNullableFilter, {nullable:true})
    paymentMethod?: EnumPaymentMethodNullableFilter;

    @Field(() => IntFilter, {nullable:true})
    quantity?: IntFilter;

    @Field(() => StringNullableFilter, {nullable:true})
    addressId?: StringNullableFilter;

    @HideField()
    createdAt?: DateTimeFilter;

    @HideField()
    updatedAt?: DateTimeFilter;

    @Field(() => UserNullableRelationFilter, {nullable:true})
    user?: UserNullableRelationFilter;

    @Field(() => MenuListRelationFilter, {nullable:true})
    Menus?: MenuListRelationFilter;

    @Field(() => AddressNullableRelationFilter, {nullable:true})
    Address?: AddressNullableRelationFilter;

    @Field(() => TransactionListRelationFilter, {nullable:true})
    Transaction?: TransactionListRelationFilter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant