Skip to content

Commit 50974bd

Browse files
committed
fix: ci pipeline
1 parent a5d0b8b commit 50974bd

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Team } from '@rocket.chat/core-services';
22
import type { ITeam, UserStatus } from '@rocket.chat/core-typings';
33
import { Users, Rooms } from '@rocket.chat/models';
4+
import type { TeamsCreateProps } from '@rocket.chat/rest-typings';
45
import {
56
isTeamsConvertToChannelProps,
67
isTeamsRemoveRoomProps,
@@ -12,7 +13,6 @@ import {
1213
isTeamsUpdateProps,
1314
isTeamsListChildrenProps,
1415
isTeamsCreateProps,
15-
TeamsCreateProps,
1616
} from '@rocket.chat/rest-typings';
1717
import { escapeRegExp } from '@rocket.chat/string-helpers';
1818
import { Match, check } from 'meteor/check';
@@ -72,12 +72,26 @@ API.v1.addRoute(
7272
async post() {
7373
const { name, type, members, room, owner } = this.bodyParams as TeamsCreateProps;
7474

75+
const sanitizedRoom = room
76+
? {
77+
...room,
78+
options: room.options
79+
? {
80+
...room.options,
81+
subscriptionExtra: room.options.subscriptionExtra
82+
? {
83+
...room.options.subscriptionExtra,
84+
ls: room.options.subscriptionExtra.ls ? new Date(room.options.subscriptionExtra.ls) : undefined,
85+
}
86+
: undefined,
87+
}
88+
: undefined,
89+
}
90+
: undefined;
91+
7592
const team = await Team.create(this.userId, {
76-
team: {
77-
name,
78-
type,
79-
},
80-
room,
93+
team: { name, type },
94+
room: sanitizedRoom,
8195
members,
8296
owner,
8397
});

apps/meteor/server/services/team/service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export class TeamService extends ServiceClassInternal implements ITeamService {
132132
...teamData,
133133
};
134134
} catch (e) {
135+
console.error('TEAM CREATE ERROR:', e);
135136
throw new Error('error-team-creation');
136137
}
137138
}

packages/core-services/src/types/IRoomService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface ISubscriptionExtraData {
99

1010
export interface ICreateRoomOptions extends Partial<Record<string, boolean | string | ISubscriptionExtraData>> {
1111
forceNew?: boolean;
12-
creator: string;
12+
creator?: string;
1313
subscriptionExtra?: ISubscriptionExtraData;
1414
}
1515

packages/rest-typings/src/v1/teams/TeamsCreateProps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const teamsCreatePropsSchema = {
6666
extraData: {
6767
type: 'object',
6868
additionalProperties: {
69-
oneOf: [{ type: 'string' }, { type: 'boolean' }],
69+
anyOf: [{ type: 'string' }, { type: 'boolean' }],
7070
},
7171
},
7272
options: {
@@ -78,7 +78,7 @@ const teamsCreatePropsSchema = {
7878
type: 'object',
7979
properties: {
8080
open: { type: 'boolean' },
81-
ls: { oneOf: [{ type: 'string' }, { type: 'object' }] },
81+
ls: { anyOf: [{ type: 'string' }, { type: 'object' }] },
8282
prid: { type: 'string' },
8383
roles: { type: 'array', items: { type: 'string' } },
8484
},

packages/rest-typings/src/v1/teams/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { IRole, IRoom, ITeam, IUser } from '@rocket.chat/core-typings';
22

33
import type { TeamsAddMembersProps } from './TeamsAddMembersProps';
4-
import type { TeamsCreateProps } from './TeamsCreateProps';
54
import type { TeamsConvertToChannelProps } from './TeamsConvertToChannelProps';
5+
import type { TeamsCreateProps } from './TeamsCreateProps';
66
import type { TeamsDeleteProps } from './TeamsDeleteProps';
77
import type { TeamsLeaveProps } from './TeamsLeaveProps';
88
import type { TeamsListChildrenProps } from './TeamsListChildren';
@@ -14,8 +14,8 @@ import type { PaginatedRequest } from '../../helpers/PaginatedRequest';
1414
import type { PaginatedResult } from '../../helpers/PaginatedResult';
1515

1616
export * from './TeamsAddMembersProps';
17-
export { TeamsCreateProps, isTeamsCreateProps } from './TeamsCreateProps';
1817
export * from './TeamsConvertToChannelProps';
18+
export { TeamsCreateProps, isTeamsCreateProps } from './TeamsCreateProps';
1919
export * from './TeamsDeleteProps';
2020
export * from './TeamsLeaveProps';
2121
export * from './TeamsRemoveMemberProps';

0 commit comments

Comments
 (0)