-listAcceptedFollowerUrlsForApi = function (id: number, start: number, count?: number) {
- return createListAcceptedFollowForApiQuery('followers', id, start, count)
-}
-
-listAcceptedFollowingUrlsForApi = function (id: number, start: number, count?: number) {
- return createListAcceptedFollowForApiQuery('following', id, start, count)
-}
-
-listFollowingForApi = function (id: number, start: number, count: number, sort: string) {
- const query = {
- distinct: true,
- offset: start,
- limit: count,
- order: [ getSort(sort) ],
- include: [
- {
- model: Account['sequelize'].models.AccountFollow,
- required: true,
- as: 'following',
- include: [
- {
- model: Account['sequelize'].models.Account,
- as: 'accountFollowing',
- required: true,
- include: [ Account['sequelize'].models.Pod ]
- }
- ]
- }
- ]
- }
-
- return Account.findAndCountAll(query).then(({ rows, count }) => {
- return {
- data: rows,
- total: count
- }
- })
-}
-
-listFollowersForApi = function (id: number, start: number, count: number, sort: string) {
- const query = {
- distinct: true,
- offset: start,
- limit: count,
- order: [ getSort(sort) ],
- include: [
- {
- model: Account['sequelize'].models.AccountFollow,
- required: true,
- as: 'followers',
- include: [
- {
- model: Account['sequelize'].models.Account,
- as: 'accountFollowers',
- required: true,
- include: [ Account['sequelize'].models.Pod ]
- }
- ]
- }
- ]
- }
-
- return Account.findAndCountAll(query).then(({ rows, count }) => {
- return {
- data: rows,
- total: count
- }
- })
-}
-