fix: added updated and deleted subscription changes (#24)
This commit is contained in:
@@ -167,15 +167,8 @@ export class UserEnvironmentsResolver {
|
||||
resolve: (value) => value,
|
||||
})
|
||||
@UseGuards(GqlAuthGuard)
|
||||
userEnvironmentUpdated(
|
||||
@Args({
|
||||
name: 'id',
|
||||
description: 'Environment id',
|
||||
type: () => ID,
|
||||
})
|
||||
id: string,
|
||||
) {
|
||||
return this.pubsub.asyncIterator(`user_environment/${id}/updated`);
|
||||
userEnvironmentUpdated(@GqlUser() user: User) {
|
||||
return this.pubsub.asyncIterator(`user_environment/${user.uid}/updated`);
|
||||
}
|
||||
|
||||
@Subscription(() => UserEnvironment, {
|
||||
@@ -183,15 +176,8 @@ export class UserEnvironmentsResolver {
|
||||
resolve: (value) => value,
|
||||
})
|
||||
@UseGuards(GqlAuthGuard)
|
||||
userEnvironmentDeleted(
|
||||
@Args({
|
||||
name: 'id',
|
||||
description: 'Environment id',
|
||||
type: () => ID,
|
||||
})
|
||||
id: string,
|
||||
) {
|
||||
return this.pubsub.asyncIterator(`user_environment/${id}/deleted`);
|
||||
userEnvironmentDeleted(@GqlUser() user: User) {
|
||||
return this.pubsub.asyncIterator(`user_environment/${user.uid}/deleted`);
|
||||
}
|
||||
|
||||
@Subscription(() => Number, {
|
||||
|
||||
@@ -369,7 +369,7 @@ describe('UserEnvironmentsService', () => {
|
||||
);
|
||||
|
||||
return expect(mockPubSub.publish).toHaveBeenCalledWith(
|
||||
`user_environment/${result.id}/updated`,
|
||||
`user_environment/${result.userUid}/updated`,
|
||||
result,
|
||||
);
|
||||
});
|
||||
@@ -398,7 +398,7 @@ describe('UserEnvironmentsService', () => {
|
||||
);
|
||||
|
||||
return expect(mockPubSub.publish).toHaveBeenCalledWith(
|
||||
`user_environment/${result.id}/updated`,
|
||||
`user_environment/${result.userUid}/updated`,
|
||||
result,
|
||||
);
|
||||
});
|
||||
@@ -463,7 +463,7 @@ describe('UserEnvironmentsService', () => {
|
||||
await userEnvironmentsService.deleteUserEnvironment('abc123', 'env1');
|
||||
|
||||
return expect(mockPubSub.publish).toHaveBeenCalledWith(
|
||||
`user_environment/${result.id}/deleted`,
|
||||
`user_environment/${result.userUid}/deleted`,
|
||||
result,
|
||||
);
|
||||
});
|
||||
@@ -557,7 +557,7 @@ describe('UserEnvironmentsService', () => {
|
||||
await userEnvironmentsService.clearGlobalEnvironments('abc123', 'env1');
|
||||
|
||||
return expect(mockPubSub.publish).toHaveBeenCalledWith(
|
||||
`user_environment/${result.id}/updated`,
|
||||
`user_environment/${result.userUid}/updated`,
|
||||
result,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -151,7 +151,7 @@ export class UserEnvironmentsService {
|
||||
};
|
||||
// Publish subscription for environment update
|
||||
await this.pubsub.publish(
|
||||
`user_environment/${updatedUserEnvironment.id}/updated`,
|
||||
`user_environment/${updatedUserEnvironment.userUid}/updated`,
|
||||
updatedUserEnvironment,
|
||||
);
|
||||
return E.right(updatedUserEnvironment);
|
||||
@@ -192,7 +192,7 @@ export class UserEnvironmentsService {
|
||||
|
||||
// Publish subscription for environment deletion
|
||||
await this.pubsub.publish(
|
||||
`user_environment/${deletedUserEnvironment.id}/deleted`,
|
||||
`user_environment/${deletedUserEnvironment.userUid}/deleted`,
|
||||
deletedUserEnvironment,
|
||||
);
|
||||
return E.right(true);
|
||||
@@ -253,7 +253,7 @@ export class UserEnvironmentsService {
|
||||
|
||||
// Publish subscription for environment update
|
||||
await this.pubsub.publish(
|
||||
`user_environment/${updatedUserEnvironment.id}/updated`,
|
||||
`user_environment/${updatedUserEnvironment.userUid}/updated`,
|
||||
updatedUserEnvironment,
|
||||
);
|
||||
return E.right(updatedUserEnvironment);
|
||||
|
||||
Reference in New Issue
Block a user