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

feature-8957: Store and Retrieve check in and out data on server #8994

Merged
merged 42 commits into from Jul 24, 2023
Merged

feature-8957: Store and Retrieve check in and out data on server #8994

merged 42 commits into from Jul 24, 2023

Conversation

nnhathung
Copy link
Contributor

Fixes #8957

Short description of what this resolves:

  • Store and Retrieve check in and out data on server

Changes proposed in this pull request:

  • implement 2 apis post and get detail user check in data

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

nnhathung and others added 30 commits July 19, 2023 00:53
set validate for station type and station name
fix ci and update latest branch from development
fix ci and update latest branch from development
fix ci and update latest branch from development
fix ci and update latest branch from development
fix ci and update latest branch from development
fix ci and update latest branch from development
…en-event-server into nnhathung_tma/feature-8958
update station_type, remove session, add new 2 types check in and check out
@nnhathung
Copy link
Contributor Author

nnhathung commented Jul 21, 2023

API for #8958

User Check in [/v1/user-check-in]

  • Request Method: POST

  • Request

    • Header

        Accept: application/vnd.api+json
      
        Authorization: JWT <Auth Key>
      
    • Body (this station_type is 'check in', attendee with id 1 with check in this session 1)

       {
           "data": {
               "attributes":{},
               "relationships": {
                   "station": {
                       "data": {
                           "type": "station",
                           "id": "1"
                       }
                   },
                   "session": {
                       "data": {
                           "type": "session",
                           "id": "1"
                       }
                   },
                   "ticket_holder": {
                       "data": {
                           "type": "attendee",
                           "id": "1"
                       }
                   }
               },
               "type": "user_check_in"
           }
       }
      
  • Response 201 create success (application/vnd.api+json)

        {
             "data": {
                 "type": "user_check_in",
                 "id": 13,
                 "attributes": {
                     "message": "Attendee check in successful.",
                     "success": true
                 },
                 "links": {
                     "self": "/v1/user-check-in/13"
                 }
             },
             "links": {
                 "self": "/v1/user-check-in/13"
             },
             "jsonapi": {
                 "version": "1.0"
             }
         }
    
  • Response 422 UNPROCESSABLE ENTITY (application/vnd.api+json)

         {
             "errors": [
                 {
                     "status": 422,
                     "source": {
                         "attendee": 1,
                         "session ": 1
                     },
                     "title": "Unprocessable Entity",
                     "detail": "Attendee already checked in."
                 }
             ],
             "jsonapi": {
                 "version": "1.0"
             }
         }
    

@nnhathung nnhathung marked this pull request as ready for review July 21, 2023 06:51
cweitat
cweitat previously approved these changes Jul 21, 2023
@mariobehling
Copy link
Member

Error: Multiple Migration Heads
Compare: https://circleci.com/gh/fossasia/open-event-server/24680


# revision identifiers, used by Alembic.
revision = '9881f067213b'
down_revision = '2b19596af9f0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 3b784f9c98c7 since another migration was included.


# revision identifiers, used by Alembic.
revision = 'e3075e4e1327'
down_revision = '9881f067213b'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have two migration files in one PR?
Please merge those into one, with the fix for the correct last revision in development mentioned above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @norbusan
because this feature have the dependency with #8958, so another migration file is from that PR.
I will fix it when #8958 is merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8958 is merged now. Thanks

@mariobehling
Copy link
Member

Please resolve conflicts.

@mariobehling mariobehling merged commit 7dbf33f into fossasia:development Jul 24, 2023
@cweitat
Copy link
Contributor

cweitat commented Jul 31, 2023

@nnhathung there's the type in your user check in body. what are the types?

is it this?
image

@nnhathung
Copy link
Contributor Author

Hi @cweitat ,
user_check_in in data of request body is api type, not station type. user_check_in type did not have any logic.
user check in and check out based on a station_id.

@cweitat
Copy link
Contributor

cweitat commented Aug 3, 2023

@nnhathung is it the same for registration? because registration has no session

@nnhathung
Copy link
Contributor Author

Hi @cweitat , the same type 'user_check_in' for registration and daily.
and one note that registration and daily can only check in one time per day.

{ "errors": [ { "status": 422, "source": { "ticket": null, "station ": 1 }, "title": "Unprocessable Entity", "detail": "Attendee already registered." } ], "jsonapi": { "version": "1.0" } }

@cweitat
Copy link
Contributor

cweitat commented Aug 3, 2023

@nnhathung so I remove session from post body if is type registration/daily?
and if i include session means its session checkin?

@cweitat
Copy link
Contributor

cweitat commented Aug 3, 2023

@nnhathung also can i check if

 "ticket_holder": {
                 "data": {
                     "type": "attendee",
                     "id": "1"
                 }
             }

is using ticket id or attendee id? because same attendee can have multiple tickets

@nnhathung
Copy link
Contributor Author

Hi @cweitat ,
As discussed, session from request is no need for station_type is registration/daily.

and if I include session means its session checkin?
-> check in/out is based on station_type.

is using ticket id or attendee id? because same attendee can have multiple tickets
-> "ticket_holder" from request is ticket_id, accordingly with ticket_holders from database.

FYI: @lthanhhieu

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

Successfully merging this pull request may close these issues.

Store and Retrieve check in and out data on server
4 participants