Chore: Remove old files from removed Omnichannel feature (#25129)
parent
fdcd2a5675
commit
3d868250ea
@ -1,31 +0,0 @@ |
||||
import { check } from 'meteor/check'; |
||||
|
||||
import { API } from '../../../../api/server'; |
||||
import { findExternalMessages } from '../../../server/api/lib/messages'; |
||||
|
||||
API.v1.addRoute( |
||||
'livechat/messages.external/:roomId', |
||||
{ authRequired: true }, |
||||
{ |
||||
get() { |
||||
check(this.urlParams, { |
||||
roomId: String, |
||||
}); |
||||
const { offset, count } = this.getPaginationItems(); |
||||
const { sort } = this.parseJsonQuery(); |
||||
|
||||
const departments = Promise.await( |
||||
findExternalMessages({ |
||||
roomId: this.urlParams.roomId, |
||||
pagination: { |
||||
offset, |
||||
count, |
||||
sort, |
||||
}, |
||||
}), |
||||
); |
||||
|
||||
return API.v1.success(departments); |
||||
}, |
||||
}, |
||||
); |
||||
@ -1,20 +0,0 @@ |
||||
import { LivechatExternalMessage } from '../../../../models/server/raw'; |
||||
|
||||
export async function findExternalMessages({ roomId, pagination: { offset, count, sort } }) { |
||||
const cursor = await LivechatExternalMessage.findByRoomId(roomId, { |
||||
sort: sort || { ts: -1 }, |
||||
skip: offset, |
||||
limit: count, |
||||
}); |
||||
|
||||
const total = await cursor.count(); |
||||
|
||||
const messages = await cursor.toArray(); |
||||
|
||||
return { |
||||
messages, |
||||
count: messages.length, |
||||
offset, |
||||
total, |
||||
}; |
||||
} |
||||
@ -1,18 +0,0 @@ |
||||
import { Base } from './_Base'; |
||||
|
||||
export class LivechatExternalMessage extends Base { |
||||
constructor() { |
||||
super('livechat_external_message'); |
||||
|
||||
this.tryEnsureIndex({ rid: 1 }); |
||||
} |
||||
|
||||
// FIND
|
||||
findByRoomId(roomId, sort = { ts: -1 }) { |
||||
const query = { rid: roomId }; |
||||
|
||||
return this.find(query, { sort }); |
||||
} |
||||
} |
||||
|
||||
export default new LivechatExternalMessage(); |
||||
@ -1,9 +0,0 @@ |
||||
import { BaseRaw } from './BaseRaw'; |
||||
|
||||
export class LivechatExternalMessageRaw extends BaseRaw { |
||||
findByRoomId(roomId, options) { |
||||
const query = { rid: roomId }; |
||||
|
||||
return this.find(query, options); |
||||
} |
||||
} |
||||
@ -1,32 +0,0 @@ |
||||
import { expect } from 'chai'; |
||||
|
||||
import { getCredentials, api, request, credentials } from '../../../data/api-data.js'; |
||||
import { updateSetting } from '../../../data/permissions.helper'; |
||||
|
||||
describe('LIVECHAT - messages', function () { |
||||
this.retries(0); |
||||
|
||||
before((done) => getCredentials(done)); |
||||
|
||||
before((done) => { |
||||
updateSetting('Livechat_enabled', true).then(done); |
||||
}); |
||||
|
||||
describe('livechat/messages.external', () => { |
||||
it('should return an array of messages', (done) => { |
||||
request |
||||
.get(api('livechat/messages.external/roomId')) |
||||
.set(credentials) |
||||
.expect('Content-Type', 'application/json') |
||||
.expect(200) |
||||
.expect((res) => { |
||||
expect(res.body).to.have.property('success', true); |
||||
expect(res.body.messages).to.be.an('array'); |
||||
expect(res.body).to.have.property('offset'); |
||||
expect(res.body).to.have.property('total'); |
||||
expect(res.body).to.have.property('count'); |
||||
}) |
||||
.end(done); |
||||
}); |
||||
}); |
||||
}); |
||||
Loading…
Reference in new issue