2019-03-02 11:25:10 +01:00
|
|
|
import AbstractModel from './abstractModel'
|
|
|
|
|
|
|
|
export default class UserModel extends AbstractModel {
|
2020-02-08 14:16:06 +01:00
|
|
|
constructor(data) {
|
|
|
|
super(data)
|
|
|
|
this.created = new Date(this.created)
|
|
|
|
this.updated = new Date(this.updated)
|
|
|
|
}
|
|
|
|
|
2019-03-02 11:25:10 +01:00
|
|
|
defaults() {
|
|
|
|
return {
|
|
|
|
id: 0,
|
2020-02-18 19:11:25 +01:00
|
|
|
avatar: '',
|
2019-03-02 11:25:10 +01:00
|
|
|
email: '',
|
|
|
|
username: '',
|
2020-02-08 14:16:06 +01:00
|
|
|
created: null,
|
|
|
|
updated: null,
|
2019-03-02 11:25:10 +01:00
|
|
|
}
|
|
|
|
}
|
2020-02-09 13:28:33 +01:00
|
|
|
|
|
|
|
getAvatarUrl(size = 50) {
|
2020-02-25 21:11:36 +01:00
|
|
|
const avatarUrl = this.avatar !== '' ? this.avatar : this.avatarUrl
|
|
|
|
return `https://www.gravatar.com/avatar/${avatarUrl}?s=${size}&d=mp`
|
2020-02-09 13:28:33 +01:00
|
|
|
}
|
2019-03-02 11:25:10 +01:00
|
|
|
}
|