Skip to content

Commit cc559a9

Browse files
committed
refactor(models): remove unnecessary JSDoc comment
1 parent 62c5486 commit cc559a9

4 files changed

Lines changed: 29 additions & 15 deletions

File tree

apps/meteor/app/api/server/v1/roles.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,24 @@ const rolesRoutes = API.v1
3838
{
3939
authRequired: true,
4040
response: {
41-
200: ajv.compile<{ roles: IRole[] }>({
41+
200: ajv.compile<{ roles: Omit<IRole, '_updatedAt'>[] }>({
4242
type: 'object',
4343
properties: {
44-
roles: { type: 'array', items: { $ref: '#/components/schemas/IRole' } },
44+
roles: {
45+
type: 'array',
46+
items: {
47+
type: 'object',
48+
properties: {
49+
_id: { type: 'string' },
50+
description: { type: 'string' },
51+
mandatory2fa: { type: 'boolean' },
52+
name: { type: 'string' },
53+
protected: { type: 'boolean' },
54+
scope: { type: 'string', enum: ['Users', 'Subscriptions'] },
55+
},
56+
required: ['_id', 'description', 'name', 'protected', 'scope'],
57+
},
58+
},
4559
success: { type: 'boolean', enum: [true] },
4660
},
4761
required: ['roles', 'success'],
@@ -187,9 +201,9 @@ const rolesRoutes = API.v1
187201
}
188202

189203
const { cursor, totalCount } = await getUsersInRolePaginated(roleData._id, roomId, {
190-
limit: count as number,
204+
limit: count,
191205
sort: { username: 1 },
192-
skip: offset as number,
206+
skip: offset,
193207
projection,
194208
});
195209

apps/meteor/app/custom-sounds/server/lib/insertOrUpdateSound.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,10 @@ export const insertOrUpdateSound = async (soundData: ICustomSoundData): Promise<
5151

5252
if (soundData.name !== soundData.previousName || soundData.extension !== soundData.previousExtension) {
5353
await CustomSounds.updateById(soundData._id, { name: soundData.name, extension: soundData.extension });
54-
void api.broadcast('notify.updateCustomSound', {
55-
soundData: {
56-
_id: soundData._id,
57-
name: soundData.name,
58-
extension: soundData.extension,
59-
},
60-
});
54+
const updatedSound = await CustomSounds.findOneById(soundData._id);
55+
if (updatedSound) {
56+
void api.broadcast('notify.updateCustomSound', { soundData: updatedSound });
57+
}
6158
}
6259

6360
return soundData._id;

apps/meteor/app/custom-sounds/server/lib/uploadCustomSound.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { api } from '@rocket.chat/core-services';
22
import type { RequiredField } from '@rocket.chat/core-typings';
3+
import { CustomSounds } from '@rocket.chat/models';
34

45
import { RocketChatFile } from '../../../file/server';
56
import type { ICustomSoundData } from '../methods/insertOrUpdateSound';
@@ -29,7 +30,12 @@ export const uploadCustomSound = async (
2930
});
3031

3132
ws.on('end', () => {
32-
setTimeout(() => api.broadcast('notify.updateCustomSound', { soundData }), 500);
33+
setTimeout(async () => {
34+
const sound = await CustomSounds.findOneById(soundData._id);
35+
if (sound) {
36+
void api.broadcast('notify.updateCustomSound', { soundData: sound });
37+
}
38+
}, 500);
3339
resolve();
3440
});
3541

packages/models/src/models/LivechatRooms.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ import type { Updater } from '../updater';
3434
import { BaseRaw } from './BaseRaw';
3535
import { readSecondaryPreferred } from '../readSecondaryPreferred';
3636

37-
/**
38-
* @extends BaseRaw<ILivechatRoom>
39-
*/
4037
export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILivechatRoomsModel {
4138
constructor(db: Db, trash?: Collection<RocketChatRecordDeleted<IOmnichannelRoom>>) {
4239
super(db, 'room', trash);

0 commit comments

Comments
 (0)