Przeglądaj źródła

reorganize interfaces

Yuki Takei 1 rok temu
rodzic
commit
9ff9b7a69f

+ 3 - 2
apps/app/src/features/questionnaire/interfaces/condition.ts

@@ -1,7 +1,8 @@
 import type { HasObjectId } from '@growi/core';
 
-import { GrowiServiceType } from './growi-info';
-import { UserType } from './user-info';
+import type { GrowiServiceType } from '~/interfaces/system';
+
+import type { UserType } from './user-info';
 
 
 interface UserCondition {

+ 7 - 30
apps/app/src/features/questionnaire/interfaces/growi-info.ts

@@ -1,37 +1,14 @@
-import * as os from 'node:os';
+import type * as os from 'node:os';
 
 import { IExternalAuthProviderType } from '@growi/core';
 
-export const GrowiServiceType = {
-  cloud: 'cloud',
-  privateCloud: 'private-cloud',
-  onPremise: 'on-premise',
-  others: 'others',
-} as const;
-export const GrowiWikiType = { open: 'open', closed: 'closed' } as const;
-export const GrowiAttachmentType = {
-  aws: 'aws',
-  gcs: 'gcs',
-  gcp: 'gcp',
-  azure: 'azure',
-  gridfs: 'gridfs',
-  mongo: 'mongo',
-  mongodb: 'mongodb',
-  local: 'local',
-  none: 'none',
-} as const;
-export const GrowiDeploymentType = {
-  officialHelmChart: 'official-helm-chart',
-  growiDockerCompose: 'growi-docker-compose',
-  node: 'node',
-  others: 'others',
-} as const;
-export const GrowiExternalAuthProviderType = IExternalAuthProviderType;
+import type { AttachmentMethodType } from '~/interfaces/attachment';
+import type { GrowiDeploymentType, GrowiServiceType } from '~/interfaces/system';
 
-export type GrowiServiceType = typeof GrowiServiceType[keyof typeof GrowiServiceType]
+export const GrowiWikiType = { open: 'open', closed: 'closed' } as const;
 type GrowiWikiType = typeof GrowiWikiType[keyof typeof GrowiWikiType]
-export type GrowiAttachmentType = typeof GrowiAttachmentType[keyof typeof GrowiAttachmentType]
-export type GrowiDeploymentType = typeof GrowiDeploymentType[keyof typeof GrowiDeploymentType]
+
+export const GrowiExternalAuthProviderType = IExternalAuthProviderType;
 export type GrowiExternalAuthProviderType = typeof GrowiExternalAuthProviderType[keyof typeof GrowiExternalAuthProviderType]
 
 interface IGrowiOSInfo {
@@ -51,7 +28,7 @@ export interface IGrowiInfo {
   currentUsersCount: number
   currentActiveUsersCount: number
   wikiType: GrowiWikiType
-  attachmentType: GrowiAttachmentType
+  attachmentType: AttachmentMethodType
   activeExternalAccountTypes?: GrowiExternalAuthProviderType[]
   osInfo?: IGrowiOSInfo
   deploymentType?: GrowiDeploymentType

+ 3 - 2
apps/app/src/features/questionnaire/server/models/schema/condition.ts

@@ -1,7 +1,8 @@
 import { Schema } from 'mongoose';
 
-import { ICondition } from '../../../interfaces/condition';
-import { GrowiServiceType } from '../../../interfaces/growi-info';
+import { GrowiServiceType } from '~/interfaces/system';
+
+import type { ICondition } from '../../../interfaces/condition';
 import { UserType } from '../../../interfaces/user-info';
 
 const conditionSchema = new Schema<ICondition>({

+ 7 - 2
apps/app/src/features/questionnaire/server/models/schema/growi-info.ts

@@ -1,9 +1,14 @@
 import { Schema } from 'mongoose';
 
+import { AttachmentMethodType } from '~/interfaces/attachment';
+import { GrowiDeploymentType, GrowiServiceType } from '~/interfaces/system';
+
+import type { IGrowiInfo } from '../../../interfaces/growi-info';
 import {
-  GrowiAttachmentType, GrowiDeploymentType, GrowiExternalAuthProviderType, GrowiServiceType, GrowiWikiType, IGrowiInfo,
+  GrowiExternalAuthProviderType, GrowiWikiType,
 } from '../../../interfaces/growi-info';
 
+
 export const growiInfoSchema = new Schema<IGrowiInfo>({
   version: { type: String, required: true },
   appSiteUrl: { type: String },
@@ -14,7 +19,7 @@ export const growiInfoSchema = new Schema<IGrowiInfo>({
   currentUsersCount: { type: Number, required: true },
   currentActiveUsersCount: { type: Number, required: true },
   wikiType: { type: String, required: true, enum: Object.values(GrowiWikiType) },
-  attachmentType: { type: String, required: true, enum: Object.values(GrowiAttachmentType) },
+  attachmentType: { type: String, required: true, enum: Object.values(AttachmentMethodType) },
   activeExternalAccountTypes: [{ type: String, enum: Object.values(GrowiExternalAuthProviderType) }],
   osInfo: {
     type: { type: String },

+ 1 - 0
apps/app/src/interfaces/activity.ts

@@ -365,6 +365,7 @@ export const ActionGroupSize = {
   Medium: 'MEDIUM',
   Large: 'LARGE',
 } as const;
+export type ActionGroupSize = typeof ActionGroupSize[keyof typeof ActionGroupSize];
 
 export const SmallActionGroup = {
   ACTION_USER_LOGIN_WITH_LOCAL,

+ 13 - 1
apps/app/src/interfaces/attachment.ts

@@ -1,7 +1,19 @@
-import type { IAttachmentHasId } from '@growi/core';
+import type { IAttachmentHasId } from '@growi/core/dist/interfaces';
 
 import type { PaginateResult } from './mongoose-utils';
 
+export const AttachmentMethodType = {
+  aws: 'aws',
+  gcs: 'gcs',
+  gcp: 'gcp',
+  azure: 'azure',
+  gridfs: 'gridfs',
+  mongo: 'mongo',
+  mongodb: 'mongodb',
+  local: 'local',
+  none: 'none',
+} as const;
+export type AttachmentMethodType = typeof AttachmentMethodType[keyof typeof AttachmentMethodType]
 
 export type IResAttachmentList = {
   paginateResult: PaginateResult<IAttachmentHasId>

+ 17 - 0
apps/app/src/interfaces/system.ts

@@ -0,0 +1,17 @@
+export const GrowiServiceType = {
+  cloud: 'cloud',
+  privateCloud: 'private-cloud',
+  onPremise: 'on-premise',
+  others: 'others',
+} as const;
+
+export const GrowiDeploymentType = {
+  officialHelmChart: 'official-helm-chart',
+  growiDockerCompose: 'growi-docker-compose',
+  node: 'node',
+  others: 'others',
+} as const;
+
+export type GrowiServiceType = typeof GrowiServiceType[keyof typeof GrowiServiceType]
+
+export type GrowiDeploymentType = typeof GrowiDeploymentType[keyof typeof GrowiDeploymentType]