From a4eaf0d6e2a81e1b52b31e8dd8edf5ffbb1a4d65 Mon Sep 17 00:00:00 2001 From: Saken Mukanov Date: Mon, 6 Mar 2023 14:45:42 +0600 Subject: [PATCH] fix and add backend: chess, kahoot --- subjects/mobile-dev/chess/README.md | 12 +- subjects/mobile-dev/chess/audit/README.md | 16 +- subjects/mobile-dev/kahoot/README.md | 32 +- subjects/mobile-dev/kahoot/audit/README.md | 18 +- subjects/mobile-dev/kahoot/swagger.yml | 334 +++++++++++++++++++++ 5 files changed, 363 insertions(+), 49 deletions(-) create mode 100644 subjects/mobile-dev/kahoot/swagger.yml diff --git a/subjects/mobile-dev/chess/README.md b/subjects/mobile-dev/chess/README.md index 6555c89b7..cfeb1f319 100644 --- a/subjects/mobile-dev/chess/README.md +++ b/subjects/mobile-dev/chess/README.md @@ -10,17 +10,9 @@ But it wasn't until the digital age that chess truly reached its potential. With So whether you're a seasoned grandmaster or a newcomer to the game, join the ranks of chess enthusiasts and experience the thrill of victory and the agony of defeat. Let the battle of the minds begin! -Your task is to develop a mobile app that allows users to play chess with each other. +Today, chess continues to be a beloved pastime, played by millions of people worldwide. And with the advent of modern technology, it has become easier than ever to play and learn the game. Mobile apps bring the game of chess to the palm of your hand, allowing you to enjoy this timeless classic anytime, anywhere. Whether you're a seasoned chess player or just starting out, chess offers a fun and engaging way to experience the history and strategy of this beloved game. -Here are the main features that the app should include: - -- A board for playing chess -- The ability for players to invite each other to a game or join a public game -- A notification system to alert players when it is their turn to make a move - -To implement these features, you may need to use various Flutter widgets and packages. You should also consider the user experience and design of the app, as a visually appealing and intuitive interface will be important for its success. - -The main objectives of this exercise are to create a functional chess app that allows players to compete against each other and to use Flutter to develop a mobile app. Good luck! +Your task is to develop a mobile app that allows users to play chess with each other. This is a fullstack app so you will need to implement both backend and frontend. You may use any desired backend technology as long as you're following the [backend routes.](https://github.com/alem-01/chess). Good luck! Here are some additional considerations to keep in mind as you work on this exercise: diff --git a/subjects/mobile-dev/chess/audit/README.md b/subjects/mobile-dev/chess/audit/README.md index 4c44509ea..0b3be47a8 100644 --- a/subjects/mobile-dev/chess/audit/README.md +++ b/subjects/mobile-dev/chess/audit/README.md @@ -1,21 +1,19 @@ #### Functional -> In order to run and hot reload app either on emulator or device, follow the [instructions](https://docs.flutter.dev/get-started/test-drive?tab=androidstudio#run-the-app) +#### In order to run and hot reload app either on emulator or device, follow the [instructions](https://docs.flutter.dev/get-started/test-drive?tab=androidstudio#run-the-app). ###### Was the app committed within the required time period? ###### Does the app run without crashes? -###### Does the app utilize Flutter to allow users to play chess with each other? +###### Check the backend. When player is the waiting room and someone joins, does the game create UUID for the game session? -###### Can players invite each other to a game or join a public game? +###### When 2 players are join game session, can a player with white pieces start the game? -###### Try playing, and doing illegal moves for pieces, i.e. move rook diagonally. It should be impossible, is that the case? +###### Try doing illegal moves, i.e. moving pawn 3 squares up, castling after moving the king, moving rook diagonally, etc. Does the app prevent such illegal moves? -###### Try castling after king or rook moves. It should be impossible, is that the case? +###### After a move is played, does the other player receive the move? -###### Is there a notification system in place to alert players when it is their turn to make a move? +###### Play the game until one player is mated, does the game stop? -###### Is the app compatible with different devices and operating systems? - -###### Is the app functional and able to meet the objectives of the exercise? \ No newline at end of file +###### Do chess moves come with appropriate Long algebraic notation? \ No newline at end of file diff --git a/subjects/mobile-dev/kahoot/README.md b/subjects/mobile-dev/kahoot/README.md index bfa355d48..74be7c029 100644 --- a/subjects/mobile-dev/kahoot/README.md +++ b/subjects/mobile-dev/kahoot/README.md @@ -1,26 +1,20 @@ -# Kahoot +### Introduction: -### Exercise +The mobile app we are creating is designed to allow users to connect with their friends and track their last known location. Upon logging into the app via email, users will be able to search for their friends by email and send friend requests. Once two users have become friends within the app, they will be able to see each other's last known location when the app was turned on. -Welcome to the world of quiz-filled adventures! In this exercise, you will have the opportunity to build a dynamic mobile app using Flutter and a ready backend with Swagger. With your app, players will be able to compete against each other in a variety of themed quizzes, track their progress, and climb to the top of the leaderboard. +The app will use location tracking technology to determine the last known location of each user. This technology will be able to determine the user's location within a certain degree of accuracy, depending on the capabilities of the device being used. -Get ready to test your knowledge and challenge your friends in this exciting new app. With the power of Flutter and a robust backend, the possibilities are endless. Are you up for the challenge? Let's get started! +Overall, the app is designed to be a fun and interactive way for users to stay connected with their friends and see where they've been. Whether you're meeting up for a night out on the town or just keeping tabs on your friends' whereabouts, this app is sure to be a hit with anyone who loves mobile technology. -In this exercise, you will build a mobile quiz game similar to [Kahoot](https://kahoot.it), implementing a backend that has been described by given Swagger. You will be provided with the API documentation for the backend, which includes all of the endpoints and request/response payloads that you will need to use in order to create the mobile app. +This app is fullstack, therefore you will have to implement both backend and frontend for the project. For the frontend part, make sure to add following functionality: -Your task will be to build a mobile app that allows users to: + - Users authenticate via email + - Ability to search friends via email + - Sending 'friends' request + - Denying/accepting 'friends' request + - Deleting from 'friends' list + - Seeing your friends last location -- Browse a list of available quizzes -- Select and play a quiz -- Answer quiz questions -- View their score and ranking after completing the quiz +To keep users' location up to date, each time the app is open, current location must be sent to the server every 5 seconds. -To complete this exercise, you will need to: - -- Familiarize yourself with the provided Swagger -- Use the backend to retrieve the list of available quizzes and the questions for each quiz -- Display the quizzes and questions in the mobile app -- Allow users to select and play a quiz -- Track and display the user's score and ranking after they complete the quiz - -This exercise will help you develop skills in building mobile apps that consume APIs, as well as testing and debugging your code. It will also help you become familiar with Swagger and the process of working with a ready backend. +To see more details on the backend part of the project, please look at the provided swagger. \ No newline at end of file diff --git a/subjects/mobile-dev/kahoot/audit/README.md b/subjects/mobile-dev/kahoot/audit/README.md index 3b3f15051..a8779ecfe 100644 --- a/subjects/mobile-dev/kahoot/audit/README.md +++ b/subjects/mobile-dev/kahoot/audit/README.md @@ -1,23 +1,19 @@ #### Functional -> In order to run and hot reload app either on emulator or device, follow the [instructions](https://docs.flutter.dev/get-started/test-drive?tab=androidstudio#run-the-app) +#### In order to run and hot reload app either on emulator or device, follow the [instructions](https://docs.flutter.dev/get-started/test-drive?tab=androidstudio#run-the-app). ###### Was the app committed within the required time period? ###### Does the app run without crashes? -###### Have you displayed the quizzes and questions in the mobile app in a visually appealing and easy-to-use manner? +###### Try loggin in. Can you authenticate via gmail? -###### Try playing the game, can you connect to it? +###### When 2 players are join game session, can a player with white pieces start the game? -###### Does app show the list of available quizzes and the questions for each quiz using the API? +###### Try doing illegal moves, i.e. moving pawn 3 squares up, castling after moving the king, moving rook diagonally, etc. Does the app prevent such illegal moves? -###### Does app have an ability for users to select and play a quiz in the mobile app? +###### After a move is played, does the other player receive the move? -###### Does app responsive and works correctly on different devices and screen sizes? +###### Play the game until one player is mated, does the game stop? -###### After tapping on correct answer do you get points? - -###### After everyone answered a question, does the app show correct answer and show current leaderboard? - -###### Have you displayed the users' score and ranking after they complete the quiz? +###### Do chess moves come with appropriate Long algebraic notation? \ No newline at end of file diff --git a/subjects/mobile-dev/kahoot/swagger.yml b/subjects/mobile-dev/kahoot/swagger.yml new file mode 100644 index 000000000..af65cf082 --- /dev/null +++ b/subjects/mobile-dev/kahoot/swagger.yml @@ -0,0 +1,334 @@ +swagger: "2.0" +info: + title: Friend Tracker API + description: API for tracking friends' locations and sending invitations + version: "1.0.0" +host: example.com +basePath: /api +schemes: + - https +consumes: + - application/json +produces: + - application/json +paths: + /auth: + post: + summary: Authenticate user via Google + description: Authenticate the user using their Google account and return an access token + parameters: + - name: id_token + in: body + description: The ID token obtained from Google after successful authentication + required: true + schema: + type: object + properties: + id_token: + type: string + responses: + 200: + description: Access token for the user + schema: + type: object + properties: + access_token: + type: string + 400: + description: Invalid ID token + 500: + description: Internal server error + + /users: + put: + summary: Update user's avatar and name + description: Update the user's avatar and name with the specified values + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + - name: avatar + in: body + required: false + schema: + type: object + properties: + avatar: + type: string + description: The new avatar image for the user + name: + description: The new name for the user + type: string + responses: + 200: + description: User info + schema: + type: object + properties: + id: + type: integer + description: The ID of the user + name: + type: string + description: The name of the user + avatar: + type: string + description: The URL of the user's avatar image + email: + type: string + description: The email address of the user + 401: + description: Unauthorized request + 500: + description: Internal server error + + /locations: + post: + summary: Submit user's location + description: Submit the user's current location to update their last known location + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + - name: latitude + in: body + description: The user's current location + required: true + schema: + type: object + properties: + latitude: + type: number + description: The user's current latitude + longitude: + type: number + description: The user's current latitude + responses: + 200: + description: Location updated successfully + 401: + description: Unauthorized request + 500: + description: Internal server error + + /invites/{user_id}: + post: + summary: Send invite to friend + description: Send an invitation to become friends with the specified user + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + - name: user_id + description: The ID of the user to send an invitation to + in: path + required: true + type: integer + responses: + 200: + description: Invitation sent successfully + 401: + description: Unauthorized request + 404: + description: User not found + 500: + description: Internal server error + + get: + summary: Get incoming and outgoing invites for user + description: Get a list of all incoming and outgoing invites for the user + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + - name: user_id + in: path + description: The ID of the user who sent the invitation + required: true + type: integer + responses: + 200: + description: List of incoming and outgoing invites for user + schema: + type: object + properties: + incoming: + type: array + items: + type: object + properties: + id: + type: integer + description: The ID of the invitation + sender: + type: object + properties: + id: + type: integer + description: The ID of the user who sent the invitation + name: + type: string + description: The name of the user who sent the invitation + avatar: + type: string + description: The URL of the avatar image of the user who sent the invitation + created_at: + type: string + format: date-time + description: The date and time the invitation was created + outgoing: + type: array + items: + type: object + properties: + id: + type: integer + description: The ID of the invitation + recipient: + type: object + properties: + id: + type: integer + description: The ID of the user who received the invitation + name: + type: string + description: The name of the user who received the invitation + avatar: + type: string + description: The URL of the avatar image of the user who received the invitation + created_at: + type: string + format: date-time + description: The date and time the invitation was created + 401: + description: Unauthorized request + 500: + description: Internal server error + + /invites/{user_id}/decline: + post: + summary: Decline invite from user + description: Decline the invitation from the specified user to become friends + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + - name: user_id + in: path + description: The ID of the user who sent the invitation + required: true + type: integer + responses: + 200: + description: Invitation declined successfully + 401: + description: Unauthorized request + 404: + description: Invitation not found + 500: + description: Internal server error + + /invites/{user_id}/accept: + post: + summary: Accept invite from user + description: Accept the invitation from the specified user to become friends + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + - name: user_id + in: path + description: The ID of the user who sent the invitation + required: true + type: integer + responses: + 200: + description: Invitation accepted successfully + 401: + description: Unauthorized request + 404: + description: Invitation not found + 500: + description: Internal server error + /friends/{id}: + delete: + summary: Delete friend from user's friend list + description: Delete the specified user from the current user's friend list + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + - name: id + in: path + description: The ID of the friend to be deleted + required: true + type: integer + responses: + 200: + description: Friend deleted successfully + 401: + description: Unauthorized request + 404: + description: Friend not found + 500: + description: Internal server error + /friends: + get: + summary: Get last locations of all friends + description: Get the last known location of all friends for the current user + parameters: + - name: authorization + in: header + description: Access token to authorize request + required: true + type: string + responses: + 200: + description: List of friends' last locations + schema: + type: array + items: + type: object + properties: + id: + type: integer + description: The ID of the friend + name: + type: string + description: The name of the friend + avatar: + type: string + description: The URL of the avatar image of the friend + location: + type: object + properties: + latitude: + type: string + description: The latitude of the friend's last known location + longitude: + type: string + description: The longitude of the friend's last known location + timestamp: + type: string + format: date-time + description: The date and time the friend's last known location was recorded + 401: + description: Unauthorized request + 500: + description: Internal server error + +