naf-service.d.ts 915 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import * as Egg from 'egg';
  2. import * as mongoose from 'mongoose';
  3. /**
  4. * NafService is a base service class that can be extended,
  5. * it's extending from {@link Service},
  6. */
  7. export class NafService extends Egg.Service {
  8. /**
  9. * 构造函数
  10. * @param ctx context对象
  11. * @param name service名称
  12. */
  13. // constructor(ctx: Context, name: String);
  14. /**
  15. * 租户ID,用于多租户系统
  16. */
  17. tenant: string;
  18. /**
  19. * 当前用户ID
  20. */
  21. userid: string;
  22. /**
  23. * 当前用户角色
  24. */
  25. role: string;
  26. /**
  27. * 当前用户标签
  28. */
  29. tags: string;
  30. /**
  31. * 服务名,用于默认序列名,可选
  32. */
  33. name: string;
  34. /**
  35. * 服务默认Model对象
  36. */
  37. model: mongoose.Model<any>;
  38. /**
  39. * 生成Id,sequence名用service的name
  40. */
  41. nextId(seqName: string = null): Number;
  42. }