- static loadByUUID (uuid: string, t?: Sequelize.Transaction) {
- const query: IFindOptions<VideoChannelModel> = {
- where: {
- uuid
- }
- }
-
- if (t !== undefined) query.transaction = t
-
- return VideoChannelModel.findOne(query)
- }
-
- static loadByUrl (url: string, t?: Sequelize.Transaction) {
- const query: IFindOptions<VideoChannelModel> = {
- where: {
- url
- },
- include: [ AccountModel ]
- }
-
- if (t !== undefined) query.transaction = t
-
- return VideoChannelModel.findOne(query)
- }
-
- static loadByUUIDOrUrl (uuid: string, url: string, t?: Sequelize.Transaction) {
- const query: IFindOptions<VideoChannelModel> = {
- where: {
- [ Sequelize.Op.or ]: [
- { uuid },
- { url }
- ]
- }
- }
-
- if (t !== undefined) query.transaction = t
-
- return VideoChannelModel.findOne(query)
- }
-
- static loadByHostAndUUID (fromHost: string, uuid: string, t?: Sequelize.Transaction) {
- const query: IFindOptions<VideoChannelModel> = {
- where: {
- uuid
- },
- include: [
- {
- model: AccountModel,
- include: [
- {
- model: ServerModel,
- required: true,
- where: {
- host: fromHost
- }
- }
- ]
- }
- ]
- }
-
- if (t !== undefined) query.transaction = t
-
- return VideoChannelModel.findOne(query)
- }
-