@kne/fastify-message 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -33,6 +33,7 @@ module.exports = fp(async function (fastify, options) {
33
33
  });
34
34
 
35
35
  fastify.register(async (fastify, options) => {
36
+ await fastify.sequelize.syncPromiseResolve;
36
37
  await fastify[options.name].services.includeTemplate(options.templateDir);
37
38
  }, options);
38
39
  });
@@ -20,8 +20,10 @@ module.exports = fp(async (fastify, options) => {
20
20
  const { models, services } = fastify[options.name];
21
21
  const includeTemplate = async dir => {
22
22
  if (!(await fs.exists(dir))) {
23
+ console.log('template dir not exists');
23
24
  return;
24
25
  }
26
+ console.log('------start include template------');
25
27
  const list = await fs.readdir(dir);
26
28
  for (const file of list) {
27
29
  const filePath = path.join(dir, file);
@@ -43,9 +45,9 @@ module.exports = fp(async (fastify, options) => {
43
45
  codeTemplate.content = content;
44
46
  codeTemplate.name = name;
45
47
  await codeTemplate.save();
48
+ console.log(`update template: ${code}`);
46
49
  continue;
47
50
  }
48
-
49
51
  await models.template.create({
50
52
  code,
51
53
  type,
@@ -53,7 +55,9 @@ module.exports = fp(async (fastify, options) => {
53
55
  content,
54
56
  level: 0
55
57
  });
58
+ console.log(`create template: ${code}`);
56
59
  }
60
+ console.log('------end include template------');
57
61
  };
58
62
 
59
63
  const parseTemplate = text => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kne/fastify-message",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.3",
4
4
  "description": "管理消息发送,支持sms消息,email消息等.",
5
5
  "main": "index.js",
6
6
  "scripts": {