# Staff Check-In - Fixed cURL Command

## Issue
The original command was missing `-X POST`, so it defaulted to GET request, which doesn't exist for check-in.

## Corrected cURL Command

```bash
curl -X POST "http://192.168.1.3:3000/staff/check-in" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer 63e2774d0256f66028b20d3827414a05bbad4f3031daac43942ca98113ec802f" \
  -H "Content-Type: application/json" \
  -d '{
    "latitude": 13.0843007,
    "longitude": 80.2704622,
    "location": "13.084301, 80.270462"
  }'
```

## Key Changes

1. **Added `-X POST`**: This specifies the HTTP method as POST
2. **Changed `--data-raw` to `-d`**: Both work, but `-d` is more standard
3. **Removed `--insecure`**: Not needed unless you have SSL certificate issues

## Alternative (Minimal Version)

```bash
curl -X POST "http://192.168.1.3:3000/staff/check-in" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"latitude": 13.0843007, "longitude": 80.2704622, "location": "13.084301, 80.270462"}'
```

## If Still Getting Authentication Error

### 1. Verify Token is Valid JWT
The token should be a JWT (has 3 parts separated by dots: `xxxxx.yyyyy.zzzzz`)

### 2. Check Token Expiration
JWT tokens expire. You may need to login again to get a fresh token.

### 3. Verify User Type
The token must be for a staff member (user_type: 'admin' or 'staff' in the JWT payload)

### 4. Test with Login First
```bash
# First, login to get a fresh JWT token
curl -X POST "http://192.168.1.3:3000/?admin_login=true" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "your_username",
    "password": "your_password",
    "mobile_no": "your_mobile",
    "device_id": "device_123",
    "device_token": "fcm_token",
    "device_type": "web"
  }'
```

Then use the `jwt_token` or `token` from the response.

## Expected Success Response

```json
{
  "status": "success",
  "message": "Check-in successful",
  "data": {
    "check_in_id": 123,
    "staff_id": 1,
    "staff_name": "Your Name",
    "check_in_time": "2025-01-15T09:00:00.000Z",
    "check_in_location": "13.084301, 80.270462",
    "check_in_latitude": 13.0843007,
    "check_in_longitude": 80.2704622,
    "status": "checked_in"
  }
}
```

## Common Errors

### Error: "Authentication failed"
- Token is invalid or expired
- Token is not a JWT token
- User type is not 'admin' or 'staff'

### Error: "Staff member is already checked in"
- You need to check out first before checking in again

### Error: "Staff member not found"
- Staff record doesn't exist in database
- Staff doesn't belong to your company

