# Building entries

Let members record when they enter the building and let staff review the entry history.

Source: https://docs.champagne.dev-ukab.fr/fr/graphql/building-entries

Champagne has no badge reader yet. Members record their own entry from the member site
with the **I'm in the building** button, and staff review each person's entry history.

## Record an entry [#record-an-entry]

```graphql
mutation EnterBuilding($clubId: ID!) {
  enterBuilding(clubId: $clubId) {
    error
    entry {
      id
      enteredAt
    }
  }
}
```

| Argument | Type  | Description                                      |
| -------- | ----- | ------------------------------------------------ |
| `clubId` | `ID!` | Club of the building. Must be the member's club. |

Only signed-in **members** of `clubId` can call it, including guests and temporary accounts
from online booking. Staff, anonymous callers and members of other clubs receive
`UNAUTHENTICATED`. The entry is always recorded for the caller.

A member whose status gives no club access (`suspended`, `banned` or `disabled`) gets
`entry: null` and the error `Only members with club access can check in.`. Members whose
bookings are blocked (`no_booking`) keep club access and can still check in. Pressing the button again within one minute returns
the previous entry instead of recording a duplicate.

## Latest entry of the member [#latest-entry-of-the-member]

```graphql
query MyLatestBuildingEntry($clubId: ID!) {
  myLatestBuildingEntry(clubId: $clubId) {
    id
    enteredAt
  }
}
```

Returns the caller's most recent entry in `clubId`, or `null` when they never checked in.
It follows the same access rules as `enterBuilding`.

## Entries of a person [#entries-of-a-person]

```graphql
query PersonBuildingEntries($clubId: ID!, $personId: ID!) {
  personBuildingEntries(clubId: $clubId, personId: $personId) {
    id
    enteredAt
  }
}
```

Returns the 20 most recent entries of `personId` in `clubId`, newest first. It follows the
same staff access rules as `person`: the caller needs `members_read` in the person's club
(administrators always have it). Other callers receive `UNAUTHENTICATED`.
