-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathuser.js
More file actions
50 lines (49 loc) · 1.77 KB
/
user.js
File metadata and controls
50 lines (49 loc) · 1.77 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const Joi = require( "joi" );
const site = require( "./site" );
module.exports = Joi.object( ).keys( {
id: Joi.number( ).integer( )
.description( "Unique auto-increment integer identifier." )
.required( ),
// TODO make this required when we've added taxon.uuid to the ident index
uuid: Joi.string( ).guid( { version: "uuidv4" } ),
created_at: Joi.string( ).isoDate( ),
description: Joi.string( ).valid( null ),
faved_project_ids: Joi.array( ).items( Joi.number( ) )
.description( "Ordered list of IDs of projects the user has faved" ),
icon: Joi.string( ).valid( null ),
icon_url: Joi.string( ).valid( null ),
identifications_count: Joi.number( ).integer( ),
journal_posts_count: Joi.number( ).integer( ),
annotated_observations_count: Joi.number( ).integer( ),
last_active: Joi.date( ).iso( ),
login: Joi.string( ),
monthly_supporter_badge: Joi.boolean( ).valid( null ),
name: Joi.string( ).valid( null ),
observations_count: Joi.number( ).integer( ),
orcid: Joi.string( ).valid( null ),
preferences: Joi.object( ).keys( {
prefers_community_taxa: Joi.boolean( )
.description( `
Whether the user allows the Community Taxon to be the taxon their observation is associated with
` ),
prefers_observation_fields_by: Joi.string( ).valid(
"anyone",
"curators",
"observer"
),
prefers_project_addition_by: Joi.string( ).valid(
"any",
"joined",
"none"
)
} ),
roles: Joi.array( ).items( Joi.string( ) ),
site: site.valid( null ),
site_id: Joi.number( ).integer( ).valid( null ),
spam: Joi.boolean( ),
species_count: Joi.number( ).integer( ),
suspended: Joi.boolean( ),
updated_at: Joi.string( ).isoDate( )
} ).unknown( false )
.meta( { className: "User" } )
.valid( null );