+ static loadByUrl (url: string, t: Transaction): Promise<MVideoShareFull> {
+ return VideoShareModel.scope(ScopeNames.FULL).findOne({
+ where: {
+ url
+ },
+ transaction: t
+ })
+ }
+
+ static listActorIdsAndFollowerUrlsByShare (videoId: number, t: Transaction) {
+ const query = `SELECT "actor"."id" AS "id", "actor"."followersUrl" AS "followersUrl" ` +
+ `FROM "videoShare" ` +
+ `INNER JOIN "actor" ON "actor"."id" = "videoShare"."actorId" ` +
+ `WHERE "videoShare"."videoId" = :videoId`
+
+ const options = {
+ type: QueryTypes.SELECT as QueryTypes.SELECT,
+ replacements: { videoId },
+ transaction: t
+ }
+
+ return VideoShareModel.sequelize.query<MActorId & MActorFollowersUrl>(query, options)
+ }
+
+ static loadActorsWhoSharedVideosOf (actorOwnerId: number, t: Transaction): Promise<MActorDefault[]> {
+ const safeOwnerId = parseInt(actorOwnerId + '', 10)
+
+ // /!\ On actor model