{"size": 845, "ext": "js", "max_stars_repo_path": "Cosmose Server/src/services/departure_service.js", "max_stars_repo_name": "wearespacey/Cosmose", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Cosmose Server/src/services/departure_service.js", "max_issues_repo_name": "wearespacey/Cosmose", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Cosmose Server/src/services/departure_service.js", "max_forks_repo_name": "wearespacey/Cosmose", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.2580645161, "max_line_length": 60, "alphanum_fraction": 0.5763313609}
const AWS = require('aws-sdk');
const dynamoClient = new AWS.DynamoDB.DocumentClient();

class DepartureService {
    constructor(client) {
        this.client = client;
    }

    async leaving(login) {
        console.log(login);
        const result = await this.client.query({
            TableName: 'Rocket',
            KeyConditionExpression: 'Login = :login',
            ExpressionAttributeValues: {
              ':login': login,
            },
          }).promise();
        console.log(result);
        const rocket = result.Items[0];
        rocket.Position = 'Out';
        await this.client.put({
            TableName: 'Rocket',
            Item: rocket,
          }).promise();
        return "it works";
    }
}

module.exports.DepartureService = DepartureService;
module.exports.service = new DepartureService(dynamoClient);
