File size: 650 Bytes
1e92f2d |
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 27 28 29 30 |
import { BaseEntity } from './entity.ts'
import { GraphQL } from './graphql.ts'
import { randEmail, randPickOne, randString } from './rand.ts'
type UserRole = 'admin' | 'user'
export type UserParams = {
name: string
email: string
role: UserRole
username: string
password: string
}
export class User extends BaseEntity {
constructor(gql: GraphQL, id: string) {
super(gql, 'user', id)
}
static randParams(): UserParams {
return {
name: 'user-' + randString(20),
email: randEmail(),
role: randPickOne(['admin', 'user']),
username: 'test-' + randString(16),
password: randString(20),
}
}
}
|