summary refs log tree commit diff
path: root/src/dto/auth/WhoAmIDto.js
blob: 5e64282e4acee23c1cc6d46f44be18a9ff9ff50b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { SafeNSoundError } from '#util/error.js';
import Joi from 'joi';

/**
 * Generic authentication DTO.
 */
export class WhoAmIDto {
    userId;
    deviceId;
    type;

    /**
     * @param data {WhoAmIDto}
     * @returns {Promise<WhoAmIDto>}
     */
    static async create(data) {
        const obj = new WhoAmIDto();
        for (const key of Object.keys(data)) {
            if (key in obj) {
                obj[key] = data[key];
            }
        }

        return obj;
    }
}