diff --git a/api/controllers/AdminController.ts b/api/controllers/AdminController.ts index b1fb41c2..5d407b8e 100644 --- a/api/controllers/AdminController.ts +++ b/api/controllers/AdminController.ts @@ -97,6 +97,6 @@ export class AdminController { async getAllUsersWithAccessLevels(@AuthenticatedUser() user: UserModel): Promise { if (!PermissionsService.canSeeAllUserAccessLevels(user)) throw new ForbiddenError(); const users = await this.userAccountService.getAllFullUserProfiles(); - return { error: null, users }; + return { error: null, users: users.map((u) => u.getFullUserProfile()) }; } } diff --git a/api/controllers/AttendanceController.ts b/api/controllers/AttendanceController.ts index ffc3c6c6..f2c035a8 100644 --- a/api/controllers/AttendanceController.ts +++ b/api/controllers/AttendanceController.ts @@ -26,14 +26,14 @@ export class AttendanceController { @AuthenticatedUser() user: UserModel): Promise { if (!PermissionsService.canSeeEventAttendances(user)) throw new ForbiddenError(); const attendances = await this.attendanceService.getAttendancesForEvent(params.uuid); - return { error: null, attendances }; + return { error: null, attendances: attendances.map((attendance) => attendance.getPublicAttendance()) }; } @UseBefore(UserAuthentication) @Get() async getAttendancesForCurrentUser(@AuthenticatedUser() user: UserModel): Promise { const attendances = await this.attendanceService.getAttendancesForCurrentUser(user); - return { error: null, attendances }; + return { error: null, attendances: attendances.map((attendance) => attendance.getPublicAttendance()) }; } @UseBefore(UserAuthentication) @@ -44,14 +44,15 @@ export class AttendanceController { return this.getAttendancesForCurrentUser(currentUser); } const attendances = await this.attendanceService.getAttendancesForUser(params.uuid); - return { error: null, attendances }; + return { error: null, attendances: attendances.map((attendance) => attendance.getPublicAttendance()) }; } @UseBefore(UserAuthentication) @Post() async attendEvent(@Body() body: AttendEventRequest, @AuthenticatedUser() user: UserModel): Promise { - const { event } = await this.attendanceService.attendEvent(user, body.attendanceCode, body.asStaff); + const attendance = await this.attendanceService.attendEvent(user, body.attendanceCode, body.asStaff); + const { event } = attendance.getPublicAttendance(); return { error: null, event }; } diff --git a/api/controllers/EventController.ts b/api/controllers/EventController.ts index ca9e2d2d..e052cddc 100644 --- a/api/controllers/EventController.ts +++ b/api/controllers/EventController.ts @@ -48,7 +48,7 @@ export class EventController { @AuthenticatedUser() user: UserModel): Promise { const canSeeAttendanceCode = !!user && PermissionsService.canEditEvents(user); const events = await this.eventService.getPastEvents(canSeeAttendanceCode, options); - return { error: null, events }; + return { error: null, events: events.map((e) => e.getPublicEvent(canSeeAttendanceCode)) }; } @UseBefore(OptionalUserAuthentication) @@ -57,7 +57,7 @@ export class EventController { @AuthenticatedUser() user: UserModel): Promise { const canSeeAttendanceCode = !!user && PermissionsService.canEditEvents(user); const events = await this.eventService.getFutureEvents(canSeeAttendanceCode, options); - return { error: null, events }; + return { error: null, events: events.map((e) => e.getPublicEvent(canSeeAttendanceCode)) }; } @UseBefore(UserAuthentication) @@ -69,7 +69,7 @@ export class EventController { if (!PermissionsService.canEditEvents(user)) throw new ForbiddenError(); const cover = await this.storageService.upload(file, MediaType.EVENT_COVER, params.uuid); const event = await this.eventService.updateByUuid(params.uuid, { cover }); - return { error: null, event }; + return { error: null, event: event.getPublicEvent(true) }; } @UseBefore(UserAuthentication) @@ -87,7 +87,7 @@ export class EventController { @AuthenticatedUser() user: UserModel): Promise { const canSeeAttendanceCode = !!user && PermissionsService.canEditEvents(user); const event = await this.eventService.findByUuid(params.uuid, canSeeAttendanceCode); - return { error: null, event }; + return { error: null, event: event.getPublicEvent(canSeeAttendanceCode) }; } @UseBefore(UserAuthentication) @@ -97,7 +97,7 @@ export class EventController { @AuthenticatedUser() user: UserModel): Promise { if (!PermissionsService.canEditEvents(user)) throw new ForbiddenError(); const event = await this.eventService.updateByUuid(params.uuid, patchEventRequest.event); - return { error: null, event }; + return { error: null, event: event.getPublicEvent(true) }; } @UseBefore(UserAuthentication) @@ -115,7 +115,7 @@ export class EventController { Promise { const canSeeAttendanceCode = !!user && PermissionsService.canEditEvents(user); const events = await this.eventService.getAllEvents(canSeeAttendanceCode, options); - return { error: null, events }; + return { error: null, events: events.map((e) => e.getPublicEvent(canSeeAttendanceCode)) }; } @UseBefore(UserAuthentication) @@ -124,6 +124,6 @@ export class EventController { @AuthenticatedUser() user: UserModel): Promise { if (!PermissionsService.canEditEvents(user)) throw new ForbiddenError(); const event = await this.eventService.create(createEventRequest.event); - return { error: null, event }; + return { error: null, event: event.getPublicEvent() }; } } diff --git a/api/controllers/FeedbackController.ts b/api/controllers/FeedbackController.ts index 91db2921..fa281e12 100644 --- a/api/controllers/FeedbackController.ts +++ b/api/controllers/FeedbackController.ts @@ -27,7 +27,7 @@ export class FeedbackController { @AuthenticatedUser() user: UserModel): Promise { const canSeeAllFeedback = PermissionsService.canSeeAllFeedback(user); const feedback = await this.feedbackService.getFeedback(canSeeAllFeedback, user, options); - return { error: null, feedback }; + return { error: null, feedback: feedback.map((fb) => fb.getPublicFeedback()) }; } @Post() @@ -35,7 +35,7 @@ export class FeedbackController { @AuthenticatedUser() user: UserModel): Promise { if (!PermissionsService.canSubmitFeedback(user)) throw new ForbiddenError(); const feedback = await this.feedbackService.submitFeedback(user, submitFeedbackRequest.feedback); - return { error: null, feedback }; + return { error: null, feedback: feedback.getPublicFeedback() }; } @Patch('/:uuid') @@ -44,6 +44,6 @@ export class FeedbackController { @AuthenticatedUser() user: UserModel): Promise { if (!PermissionsService.canSeeAllFeedback(user)) throw new ForbiddenError(); const feedback = await this.feedbackService.updateFeedbackStatus(params.uuid, updateFeedbackStatusRequest.status); - return { error: null, feedback }; + return { error: null, feedback: feedback.getPublicFeedback() }; } } diff --git a/api/controllers/LeaderboardController.ts b/api/controllers/LeaderboardController.ts index a4c598db..310f144d 100644 --- a/api/controllers/LeaderboardController.ts +++ b/api/controllers/LeaderboardController.ts @@ -17,6 +17,6 @@ export class LeaderboardController { async getLeaderboard(@QueryParams() filters: SlidingLeaderboardQueryParams): Promise { const { from, to, offset, limit } = filters; const leaderboard = await this.userAccountService.getLeaderboard(from, to, offset, limit); - return { error: null, leaderboard }; + return { error: null, leaderboard: leaderboard.map((u) => u.getPublicProfile()) }; } } diff --git a/api/controllers/MerchStoreController.ts b/api/controllers/MerchStoreController.ts index 9735045f..bb13af1b 100644 --- a/api/controllers/MerchStoreController.ts +++ b/api/controllers/MerchStoreController.ts @@ -97,7 +97,7 @@ export class MerchStoreController { if (!PermissionsService.canAccessMerchStore(user)) throw new ForbiddenError(); const canSeeHiddenItems = PermissionsService.canEditMerchStore(user); const collection = await this.merchStoreService.findCollectionByUuid(params.uuid, canSeeHiddenItems); - return { error: null, collection }; + return { error: null, collection: canSeeHiddenItems ? collection : collection.getPublicMerchCollection() }; } @Get('/collection') @@ -105,7 +105,7 @@ export class MerchStoreController { if (!PermissionsService.canAccessMerchStore(user)) throw new ForbiddenError(); const canSeeInactiveCollections = PermissionsService.canEditMerchStore(user); const collections = await this.merchStoreService.getAllCollections(canSeeInactiveCollections); - return { error: null, collections }; + return { error: null, collections: collections.map((c) => c.getPublicMerchCollection(canSeeInactiveCollections)) }; } @Post('/collection') @@ -153,7 +153,7 @@ export class MerchStoreController { params.uuid, { uploadedPhoto, position }, ); - return { error: null, collectionPhoto }; + return { error: null, collectionPhoto: collectionPhoto.getPublicMerchCollectionPhoto() }; } @UseBefore(UserAuthentication) @@ -222,7 +222,7 @@ export class MerchStoreController { params.uuid, { uploadedPhoto, position }, ); - return { error: null, merchPhoto }; + return { error: null, merchPhoto: merchPhoto.getPublicMerchItemPhoto() }; } @UseBefore(UserAuthentication) @@ -242,7 +242,7 @@ export class MerchStoreController { Promise { if (!PermissionsService.canEditMerchStore(user)) throw new ForbiddenError(); const option = await this.merchStoreService.createItemOption(params.uuid, createItemOptionRequest.option); - return { error: null, option }; + return { error: null, option: option.getPublicMerchItemOption() }; } @Delete('/option/:uuid') diff --git a/api/controllers/UserController.ts b/api/controllers/UserController.ts index 1ecb88e5..13475fdb 100644 --- a/api/controllers/UserController.ts +++ b/api/controllers/UserController.ts @@ -50,14 +50,14 @@ export class UserController { return this.getCurrentUserActivityStream(currentUser); } const activityStream = await this.userAccountService.getUserActivityStream(params.uuid); - return { error: null, activity: activityStream }; + return { error: null, activity: activityStream.map((activity) => activity.getPublicActivity()) }; } @Get('/activity') async getCurrentUserActivityStream(@AuthenticatedUser() user: UserModel): Promise { const activityStream = await this.userAccountService.getCurrentUserActivityStream(user.uuid); - return { error: null, activity: activityStream }; + return { error: null, activity: activityStream.map((activity) => activity.getPublicActivity()) }; } @Post('/picture') diff --git a/services/AttendanceService.ts b/services/AttendanceService.ts index 166ef16f..fed27a41 100644 --- a/services/AttendanceService.ts +++ b/services/AttendanceService.ts @@ -20,31 +20,31 @@ export default class AttendanceService { this.transactions = new TransactionsManager(entityManager); } - public async getAttendancesForEvent(event: Uuid): Promise { + public async getAttendancesForEvent(event: Uuid): Promise { const attendances = await this.transactions.readOnly(async (txn) => Repositories .attendance(txn) .getAttendancesForEvent(event)); - return attendances.map((attendance) => attendance.getPublicAttendance()); + return attendances; } - public async getAttendancesForCurrentUser(user: UserModel): Promise { + public async getAttendancesForCurrentUser(user: UserModel): Promise { const attendances = await this.transactions.readOnly(async (txn) => Repositories .attendance(txn) .getAttendancesForUser(user)); - return attendances.map((attendance) => attendance.getPublicAttendance()); + return attendances; } - public async getAttendancesForUser(uuid: Uuid): Promise { + public async getAttendancesForUser(uuid: Uuid): Promise { return this.transactions.readOnly(async (txn) => { const user = await Repositories.user(txn).findByUuid(uuid); if (!user) throw new NotFoundError('User does not exist'); if (!user.isAttendancePublic) throw new ForbiddenError(); const attendances = await Repositories.attendance(txn).getAttendancesForUser(user); - return attendances.map((attendance) => attendance.getPublicAttendance()); + return attendances; }); } - public async attendEvent(user: UserModel, attendanceCode: string, asStaff = false): Promise { + public async attendEvent(user: UserModel, attendanceCode: string, asStaff = false): Promise { return this.transactions.readWrite(async (txn) => { const event = await Repositories.event(txn).findByAttendanceCode(attendanceCode); @@ -54,7 +54,7 @@ export default class AttendanceService { if (hasAlreadyAttended) throw new UserError('You have already attended this event'); const attendance = await this.writeEventAttendance(user, event, asStaff, txn); - return attendance.getPublicAttendance(); + return attendance; }); } @@ -181,7 +181,7 @@ export default class AttendanceService { return Repositories.attendance(txn).writeAttendanceBatch(attendances); } - public async submitEventFeedback(feedback: string[], eventUuid: Uuid, user: UserModel): Promise { + public async submitEventFeedback(feedback: string[], eventUuid: Uuid, user: UserModel): Promise { return this.transactions.readWrite(async (txn) => { const attendanceRepository = Repositories.attendance(txn); @@ -206,7 +206,7 @@ export default class AttendanceService { }); await Repositories.user(txn).addPoints(user, pointsEarned); - return attendanceWithFeedback.getPublicAttendance(); + return attendanceWithFeedback; }); } } diff --git a/services/EventService.ts b/services/EventService.ts index 9994e080..7f51e226 100644 --- a/services/EventService.ts +++ b/services/EventService.ts @@ -3,7 +3,7 @@ import { InjectManager } from 'typeorm-typedi-extensions'; import { ForbiddenError, NotFoundError } from 'routing-controllers'; import { EntityManager } from 'typeorm'; import { EventModel } from '../models/EventModel'; -import { Uuid, PublicEvent, Event, EventSearchOptions } from '../types'; +import { Uuid, Event, EventSearchOptions } from '../types'; import Repositories, { TransactionsManager } from '../repositories'; import { UserError } from '../utils/Errors'; @@ -21,7 +21,7 @@ export default class EventService { * @param event object with all the properties of the event * @returns The event that was created */ - public async create(event: Event): Promise { + public async create(event: Event): Promise { const eventCreated = await this.transactions.readWrite(async (txn) => { const eventRepository = Repositories.event(txn); const isUnusedAttendanceCode = await eventRepository.isUnusedAttendanceCode(event.attendanceCode); @@ -29,40 +29,40 @@ export default class EventService { if (event.start > event.end) throw new UserError('Start date after end date'); return eventRepository.upsertEvent(EventModel.create(event)); }); - return eventCreated.getPublicEvent(); + return eventCreated; } - public async getAllEvents(canSeeAttendanceCode = false, options: EventSearchOptions): Promise { + public async getAllEvents(canSeeAttendanceCode = false, options: EventSearchOptions): Promise { const events = await this.transactions.readOnly(async (txn) => Repositories .event(txn) .getAllEvents(options)); - return events.map((e) => e.getPublicEvent(canSeeAttendanceCode)); + return events; } - public async getPastEvents(canSeeAttendanceCode = false, options: EventSearchOptions): Promise { + public async getPastEvents(canSeeAttendanceCode = false, options: EventSearchOptions): Promise { options.reverse ??= true; const events = await this.transactions.readOnly(async (txn) => Repositories .event(txn) .getPastEvents(options)); - return events.map((e) => e.getPublicEvent(canSeeAttendanceCode)); + return events; } - public async getFutureEvents(canSeeAttendanceCode = false, options: EventSearchOptions): Promise { + public async getFutureEvents(canSeeAttendanceCode = false, options: EventSearchOptions): Promise { const events = await this.transactions.readOnly(async (txn) => Repositories .event(txn) .getFutureEvents(options)); - return events.map((e) => e.getPublicEvent(canSeeAttendanceCode)); + return events; } - public async findByUuid(uuid: Uuid, canSeeAttendanceCode = false): Promise { + public async findByUuid(uuid: Uuid, canSeeAttendanceCode = false): Promise { const event = await this.transactions.readOnly(async (txn) => Repositories .event(txn) .findByUuid(uuid)); if (!event) throw new NotFoundError('Event not found'); - return event.getPublicEvent(canSeeAttendanceCode); + return event; } - public async updateByUuid(uuid: Uuid, changes: Partial): Promise { + public async updateByUuid(uuid: Uuid, changes: Partial): Promise { const updatedEvent = await this.transactions.readWrite(async (txn) => { const eventRepository = Repositories.event(txn); const currentEvent = await eventRepository.findByUuid(uuid); @@ -73,7 +73,7 @@ export default class EventService { } return eventRepository.upsertEvent(currentEvent, changes); }); - return updatedEvent.getPublicEvent(true); + return updatedEvent; } public async deleteByUuid(uuid: Uuid): Promise { diff --git a/services/FeedbackService.ts b/services/FeedbackService.ts index f8d5f059..7da90502 100644 --- a/services/FeedbackService.ts +++ b/services/FeedbackService.ts @@ -5,7 +5,7 @@ import { NotFoundError } from 'routing-controllers'; import { FeedbackModel } from '../models/FeedbackModel'; import { UserModel } from '../models/UserModel'; import Repositories, { TransactionsManager } from '../repositories'; -import { PublicFeedback, Feedback, Uuid, ActivityType, FeedbackStatus, FeedbackSearchOptions } from '../types'; +import { Feedback, Uuid, ActivityType, FeedbackStatus, FeedbackSearchOptions } from '../types'; import { UserError } from '../utils/Errors'; @Service() @@ -17,20 +17,19 @@ export default class FeedbackService { } public async getFeedback(canSeeAllFeedback = false, user: UserModel, - options: FeedbackSearchOptions): Promise { + options: FeedbackSearchOptions): Promise { return this.transactions.readOnly(async (txn) => { const feedbackRepository = Repositories.feedback(txn); if (canSeeAllFeedback) { - return (await feedbackRepository.getAllFeedback(options)) - .map((fb) => fb.getPublicFeedback()); + return (feedbackRepository.getAllFeedback(options)); } const userFeedback = await feedbackRepository.getStandardUserFeedback(user, options); - return userFeedback.map((fb) => fb.getPublicFeedback()); + return userFeedback; }); } - public async submitFeedback(user: UserModel, feedback: Feedback): Promise { + public async submitFeedback(user: UserModel, feedback: Feedback): Promise { return this.transactions.readWrite(async (txn) => { const event = await Repositories.event(txn).findByUuid(feedback.event); if (!event) throw new NotFoundError('Event not found!'); @@ -45,11 +44,11 @@ export default class FeedbackService { type: ActivityType.SUBMIT_FEEDBACK, }); const addedFeedback = await feedbackRepository.upsertFeedback(FeedbackModel.create({ ...feedback, user, event })); - return addedFeedback.getPublicFeedback(); + return addedFeedback; }); } - public async updateFeedbackStatus(uuid: Uuid, status: FeedbackStatus) { + public async updateFeedbackStatus(uuid: Uuid, status: FeedbackStatus): Promise { return this.transactions.readWrite(async (txn) => { const feedbackRepository = Repositories.feedback(txn); const feedback = await feedbackRepository.findByUuid(uuid); @@ -64,7 +63,7 @@ export default class FeedbackService { type: ActivityType.FEEDBACK_ACKNOWLEDGED, }); const updatedFeedback = await feedbackRepository.upsertFeedback(feedback, { status }); - return updatedFeedback.getPublicFeedback(); + return updatedFeedback; }); } } diff --git a/services/MerchStoreService.ts b/services/MerchStoreService.ts index 28c6f4b5..d709fa9e 100644 --- a/services/MerchStoreService.ts +++ b/services/MerchStoreService.ts @@ -13,12 +13,9 @@ import { MerchItem, MerchItemOption, MerchItemEdit, - PublicMerchItemOption, OrderStatus, PublicMerchItemWithPurchaseLimits, - PublicMerchItemPhoto, MerchItemPhoto, - PublicMerchCollectionPhoto, MerchCollectionPhoto, } from '../types'; import { MerchandiseItemModel } from '../models/MerchandiseItemModel'; @@ -70,25 +67,26 @@ export default class MerchStoreService { }); } - public async findCollectionByUuid(uuid: Uuid, canSeeInactiveCollections = false): Promise { + public async findCollectionByUuid(uuid: Uuid, canSeeInactiveCollections = false): + Promise { const collection = await this.transactions.readOnly(async (txn) => Repositories .merchStoreCollection(txn) .findByUuid(uuid)); if (!collection) throw new NotFoundError('Merch collection not found'); if (collection.archived && !canSeeInactiveCollections) throw new ForbiddenError(); collection.collectionPhotos = collection.collectionPhotos.sort((a, b) => a.position - b.position); - return canSeeInactiveCollections ? collection : collection.getPublicMerchCollection(); + return collection; } - public async getAllCollections(canSeeInactiveCollections = false, canSeeHiddenItems = canSeeInactiveCollections): - Promise { + public async getAllCollections(canSeeInactiveCollections = false): + Promise { return this.transactions.readOnly(async (txn) => { const merchCollectionRepository = Repositories.merchStoreCollection(txn); if (canSeeInactiveCollections) { return merchCollectionRepository.getAllCollections(); } const collections = await merchCollectionRepository.getAllActiveCollections(); - return collections.map((c) => c.getPublicMerchCollection(canSeeHiddenItems)); + return collections; }); } @@ -177,7 +175,7 @@ export default class MerchStoreService { * @returns created collection photo */ public async createCollectionPhoto(collection: Uuid, properties: MerchCollectionPhoto): - Promise { + Promise { return this.transactions.readWrite(async (txn) => { const merchCollection = await Repositories.merchStoreCollection(txn).findByUuid(collection); if (!merchCollection) throw new NotFoundError('Collection not found'); @@ -190,7 +188,7 @@ export default class MerchStoreService { MerchStoreService.verifyCollectionHasValidPhotos(merchCollection); const upsertedPhoto = await merchStoreCollectionPhotoRepository.upsertCollectionPhoto(createdPhoto); - return upsertedPhoto.getPublicMerchCollectionPhoto(); + return upsertedPhoto; }); } @@ -358,7 +356,7 @@ export default class MerchStoreService { * @param option merch item option * @returns created item option */ - public async createItemOption(item: Uuid, option: MerchItemOption): Promise { + public async createItemOption(item: Uuid, option: MerchItemOption): Promise { return this.transactions.readWrite(async (txn) => { const merchItem = await Repositories.merchStoreItem(txn).findByUuid(item); if (!merchItem) throw new NotFoundError('Merch item not found'); @@ -369,7 +367,7 @@ export default class MerchStoreService { MerchStoreService.verifyItemHasValidOptions(merchItem); const upsertedOption = await merchItemOptionRepository.upsertMerchItemOption(createdOption); - return upsertedOption.getPublicMerchItemOption(); + return upsertedOption; }); } @@ -414,7 +412,7 @@ export default class MerchStoreService { * @param properties merch item photo picture url and position * @returns created item photo */ - public async createItemPhoto(item: Uuid, properties: MerchItemPhoto): Promise { + public async createItemPhoto(item: Uuid, properties: MerchItemPhoto): Promise { return this.transactions.readWrite(async (txn) => { const merchItem = await Repositories.merchStoreItem(txn).findByUuid(item); if (!merchItem) throw new NotFoundError('Merch item not found'); @@ -427,7 +425,7 @@ export default class MerchStoreService { MerchStoreService.verifyItemHasValidPhotos(merchItem); const upsertedPhoto = await merchStoreItemPhotoRepository.upsertMerchItemPhoto(createdPhoto); - return upsertedPhoto.getPublicMerchItemPhoto(); + return upsertedPhoto; }); } diff --git a/services/UserAccountService.ts b/services/UserAccountService.ts index ab0dc926..981f0b9a 100644 --- a/services/UserAccountService.ts +++ b/services/UserAccountService.ts @@ -10,12 +10,12 @@ import { englishDataset, englishRecommendedTransformers, } from 'obscenity'; +import { ActivityModel } from 'models/ActivityModel'; import Repositories, { TransactionsManager } from '../repositories'; import { Uuid, PublicProfile, ActivityType, - PublicActivity, Milestone, UserPatches, UserState, @@ -75,7 +75,7 @@ export default class UserAccountService { }); } - public async getLeaderboard(from?: number, to?: number, offset = 0, limit = 100): Promise { + public async getLeaderboard(from?: number, to?: number, offset = 0, limit = 100): Promise { // convert timestamps from seconds to milliseconds if (from) from *= 1000; if (to) to *= 1000; @@ -104,7 +104,7 @@ export default class UserAccountService { if (!from) from = moment(earliest).startOf('day').valueOf(); return leaderboardRepository.getLeaderboardUntil(from, to, offset, limit); }); - return users.map((u) => u.getPublicProfile()); + return users; } public async update(user: UserModel, userPatches: UserPatches): Promise { @@ -144,19 +144,19 @@ export default class UserAccountService { .upsertUser(user, { profilePicture })); } - public async getCurrentUserActivityStream(uuid: Uuid): Promise { + public async getCurrentUserActivityStream(uuid: Uuid): Promise { const stream = await this.transactions.readOnly(async (txn) => Repositories .activity(txn) .getCurrentUserActivityStream(uuid)); - return stream.map((activity) => activity.getPublicActivity()); + return stream; } - public async getUserActivityStream(uuid: Uuid): Promise { + public async getUserActivityStream(uuid: Uuid): Promise { const activityStream = await this.transactions.readOnly(async (txn) => { const user = await this.findByUuid(uuid); return Repositories.activity(txn).getUserActivityStream(user.uuid); }); - return activityStream.map((activity) => activity.getPublicActivity()); + return activityStream; } public async createMilestone(milestone: Milestone): Promise { @@ -276,10 +276,10 @@ export default class UserAccountService { }); } - public async getAllFullUserProfiles(): Promise { + public async getAllFullUserProfiles(): Promise { const users = await this.transactions.readOnly(async (txn) => Repositories .user(txn) .findAll()); - return users.map((user) => user.getFullUserProfile()); + return users; } }