Skip to content

Do we need to filter applications by user id for security? #9

@ehowey

Description

@ehowey

Hey Amy!

Hope you are well! Great tutorial by the way!! I appreciate the detail!

I was wondering in these lines of code in the List.tsx page do we not need to have a filter for user id so that users are not seeing all of the applications?

const applications = await db.application.findMany({
    include: {
      status: true,
      company: {
        include: {
          contacts: true,
        },
      },
    },
    where: {
      archived: status === "archived" ? true : false,
    },
  });

Basically something like:

where: {
  user:  ctx.user.id ?? ""
}

Or is that happening automatically behind the scenes and I missed that getting explained?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions