Skip to content

Commit

Permalink
[add] Activity model configuration
Browse files Browse the repository at this point in the history
[fix] 2 defail bugs
  • Loading branch information
TechQuery committed Nov 27, 2023
1 parent faef175 commit 2828cf8
Show file tree
Hide file tree
Showing 9 changed files with 434 additions and 79 deletions.
17 changes: 10 additions & 7 deletions config/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,23 @@ export default ({ env }) => {

const connections = {
mysql: {
connection: { ...connection, port: port || 3306, connectionString },
connection: connectionString
? { connectionString }
: { ...connection, port: port || 3306 },
pool,
},
mysql2: {
connection: { ...connection, port: port || 3306 },
pool,
},
postgres: {
connection: {
...connection,
port: port || 5432,
connectionString,
schema: env('DATABASE_SCHEMA', 'public'),
},
connection: connectionString
? { connectionString, schema: env('DATABASE_SCHEMA', 'public') }
: {
...connection,
port: port || 5432,
schema: env('DATABASE_SCHEMA', 'public'),
},
pool,
},
sqlite: {
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ services:
- DATABASE_CLIENT=postgres
- DATABASE_URL=postgres://postgres:${ADMIN_JWT_SECRET}@postgres-server:5432/postgres
- NODE_ENV=production
- PORT=1337
ports:
- 1337:1337
healthcheck:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohp/web-server",
"version": "0.4.0",
"version": "0.5.0",
"private": true,
"engines": {
"node": ">=18.0.0 <=20.x.x",
Expand All @@ -26,9 +26,9 @@
"styled-components": "^5.3.11"
},
"devDependencies": {
"@codemirror/autocomplete": "^6.11.0",
"@codemirror/autocomplete": "^6.11.1",
"@codemirror/lint": "^6.4.2",
"@codemirror/search": "^6.5.4",
"@codemirror/search": "^6.5.5",
"@codemirror/theme-one-dark": "^6.1.2",
"cross-env": "^7.0.3",
"get-git-folder": "^0.1.2",
Expand All @@ -48,7 +48,7 @@
"test": "lint-staged",
"strapi": "strapi",
"clean": "rm -rf .cache/ .strapi/ dist/",
"develop": "npm run clean && strapi build && strapi develop",
"develop": "npm run clean && strapi ts:generate-types && strapi build && strapi develop",
"build": "npm run clean && cross-env NODE_ENV=production strapi build",
"start": "cross-env NODE_ENV=production strapi start",
"pack-image": "docker build -t ohp/strapi-server:latest .",
Expand Down
134 changes: 67 additions & 67 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

169 changes: 169 additions & 0 deletions src/api/activity/content-types/activity/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"kind": "collectionType",
"collectionName": "activities",
"info": {
"singularName": "activity",
"pluralName": "activities",
"displayName": "Activity",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"name": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string",
"required": true,
"unique": true
},
"displayName": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string",
"required": true,
"unique": true
},
"ribbon": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string",
"required": false
},
"summary": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"detail": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "customField",
"options": {
"output": "HTML",
"preset": "rich"
},
"required": true,
"customField": "plugin::ckeditor.CKEditor"
},
"banners": {
"allowedTypes": ["images", "videos"],
"type": "media",
"multiple": true,
"pluginOptions": {
"i18n": {
"localized": true
}
},
"required": true
},
"status": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "enumeration",
"enum": ["planning", "pendingApproval", "online", "offline"],
"default": "planning",
"required": true
},
"creator": {
"type": "relation",
"relation": "oneToOne",
"target": "plugin::users-permissions.user"
},
"maxEnrollment": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "integer",
"min": 0
},
"tags": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"eventStartedAt": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "datetime",
"required": true
},
"eventEndedAt": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "datetime",
"required": true
},
"enrollmentStartedAt": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "datetime",
"required": true
},
"enrollmentEndedAt": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "datetime",
"required": true
},
"judgeStartedAt": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "datetime",
"required": true
},
"judgeEndedAt": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "datetime",
"required": true
}
}
}
7 changes: 7 additions & 0 deletions src/api/activity/controllers/activity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* activity controller
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreController('api::activity.activity');
7 changes: 7 additions & 0 deletions src/api/activity/routes/activity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* activity router
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreRouter('api::activity.activity');
7 changes: 7 additions & 0 deletions src/api/activity/services/activity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* activity service
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreService('api::activity.activity');
Loading

0 comments on commit 2828cf8

Please sign in to comment.