mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Type models
This commit is contained in:
parent
65fcc3119c
commit
e02643f32e
76 changed files with 1710 additions and 816 deletions
45
server/models/user-interface.ts
Normal file
45
server/models/user-interface.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import * as Sequelize from 'sequelize'
|
||||
|
||||
export namespace UserMethods {
|
||||
export type IsPasswordMatch = (password, callback) => void
|
||||
export type ToFormatedJSON = () => void
|
||||
export type IsAdmin = () => boolean
|
||||
|
||||
export type CountTotal = (callback) => void
|
||||
export type GetByUsername = (username) => any
|
||||
export type List = (callback) => void
|
||||
export type ListForApi = (start, count, sort, callback) => void
|
||||
export type LoadById = (id, callback) => void
|
||||
export type LoadByUsername = (username, callback) => void
|
||||
export type LoadByUsernameOrEmail = (username, email, callback) => void
|
||||
}
|
||||
|
||||
export interface UserClass {
|
||||
isPasswordMatch: UserMethods.IsPasswordMatch,
|
||||
toFormatedJSON: UserMethods.ToFormatedJSON,
|
||||
isAdmin: UserMethods.IsAdmin,
|
||||
|
||||
countTotal: UserMethods.CountTotal,
|
||||
getByUsername: UserMethods.GetByUsername,
|
||||
list: UserMethods.List,
|
||||
listForApi: UserMethods.ListForApi,
|
||||
loadById: UserMethods.LoadById,
|
||||
loadByUsername: UserMethods.LoadByUsername,
|
||||
loadByUsernameOrEmail: UserMethods.LoadByUsernameOrEmail
|
||||
}
|
||||
|
||||
export interface UserAttributes {
|
||||
password: string
|
||||
username: string
|
||||
email: string
|
||||
displayNSFW?: boolean
|
||||
role: string
|
||||
}
|
||||
|
||||
export interface UserInstance extends UserClass, UserAttributes, Sequelize.Instance<UserAttributes> {
|
||||
id: number
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
|
||||
export interface UserModel extends UserClass, Sequelize.Model<UserInstance, UserAttributes> {}
|
Loading…
Add table
Add a link
Reference in a new issue