فهرست منبع

[API] Topic Deatils mocks

Oleg Shuralev 5 سال پیش
والد
کامیت
ea4b9dc0b4
2فایلهای تغییر یافته به همراه18 افزوده شده و 3 حذف شده
  1. 10 0
      api/mocks/topicDetails.js
  2. 8 3
      api/services/topics.js

+ 10 - 0
api/mocks/topicDetails.js

@@ -0,0 +1,10 @@
+module.exports = {
+  partitionCount: 25,
+  replicationFactor: 1,
+  replicas: 25,
+  inSyncReplicas: 25,
+  bytesInPerSec: 0,
+  segmentSize: 0,
+  segmentCount: 25,
+  underReplicatedPartitions: 0
+};

+ 8 - 3
api/services/topics.js

@@ -1,11 +1,16 @@
 'use strict'
 
 const topics = require('../mocks/topics');
+const topicDetails = require('../mocks/topicDetails');
 
 module.exports = function (fastify, opts, next) {
-  fastify.get('/clusters/:clusterId/topics', function (request, reply) {
-    reply.send(topics[request.params.clusterId]);
-  });
+  fastify
+    .get('/clusters/:clusterId/topics', function (request, reply) {
+      reply.send(topics[request.params.clusterId]);
+    })
+    .get('/clusters/:clusterId/topics/:topicId', function (request, reply) {
+      reply.send(topicDetails);
+    });
 
   next();
 }