-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1070 from line/dev
release: 6.2449.71
- Loading branch information
Showing
22 changed files
with
3,350 additions
and
3,161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Publish Api Docs to GitHub Pages | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
publish-api-docs: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.0.39 | ||
env: | ||
MYSQL_ROOT_PASSWORD: userfeedback | ||
MYSQL_DATABASE: userfeedback | ||
MYSQL_USER: userfeedback | ||
MYSQL_PASSWORD: userfeedback | ||
TZ: UTC | ||
ports: | ||
- 13306:3306 | ||
|
||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build app and swagger docs | ||
run: | | ||
npx corepack enable | ||
pnpm install --frozen-lockfile | ||
pnpm build | ||
cd apps/api | ||
cp .env.example .env | ||
npx ts-node -r tsconfig-paths/register src/scripts/build-swagger-docs.ts | ||
- name: Run Redocly CLI | ||
uses: fluximus-prime/redocly-cli-github-action@v1 | ||
with: | ||
args: "build-docs apps/api/swagger.json --output docs/index.html" | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20.18.0 | ||
22.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* Copyright 2023 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { | ||
Controller, | ||
Get, | ||
Param, | ||
ParseIntPipe, | ||
UseGuards, | ||
} from '@nestjs/common'; | ||
import { | ||
ApiOkResponse, | ||
ApiOperation, | ||
ApiParam, | ||
ApiSecurity, | ||
ApiTags, | ||
} from '@nestjs/swagger'; | ||
|
||
import { ApiKeyAuthGuard } from '@/domains/admin/auth/guards'; | ||
import { FindProjectByIdResponseDto } from '../admin/project/project/dtos/responses/find-project-by-id-response.dto'; | ||
import { ProjectService } from '../admin/project/project/project.service'; | ||
|
||
@ApiTags('projects') | ||
@Controller('/projects/:projectId') | ||
@ApiSecurity('apiKey') | ||
@UseGuards(ApiKeyAuthGuard) | ||
export class ProjectController { | ||
constructor(private readonly projectService: ProjectService) {} | ||
|
||
@ApiOperation({ | ||
summary: 'Get Project Info', | ||
description: 'Retreives a project info by project id.', | ||
}) | ||
@ApiParam({ | ||
name: 'projectId', | ||
type: Number, | ||
description: 'Project id', | ||
example: 1, | ||
}) | ||
@ApiOkResponse({ | ||
type: FindProjectByIdResponseDto, | ||
description: 'Project info', | ||
}) | ||
@ApiOkResponse({ type: FindProjectByIdResponseDto }) | ||
@Get('/') | ||
async getProjectInfo(@Param('projectId', ParseIntPipe) projectId: number) { | ||
return FindProjectByIdResponseDto.transform( | ||
await this.projectService.findById({ projectId }), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright 2023 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { writeFileSync } from 'fs'; | ||
import { NestFactory } from '@nestjs/core'; | ||
import type { NestFastifyApplication } from '@nestjs/platform-fastify'; | ||
import { FastifyAdapter } from '@nestjs/platform-fastify'; | ||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; | ||
import { initializeTransactionalContext } from 'typeorm-transactional'; | ||
|
||
import { AppModule } from '../app.module'; | ||
import { APIModule } from '../domains/api/api.module'; | ||
|
||
async function generateSwaggerDoc() { | ||
initializeTransactionalContext(); | ||
const app = await NestFactory.create<NestFastifyApplication>( | ||
AppModule, | ||
new FastifyAdapter({}), | ||
{ bufferLogs: true }, | ||
); | ||
|
||
const documentConfig = new DocumentBuilder() | ||
.setTitle('User Feedback API Document') | ||
.setDescription( | ||
`You can use this API to integrate with your own service or system. This API is protected by a simple API key authentication, so please do not expose this API to the public. You can make an API key in the admin setting page. You should put the API key in the header with the key name 'x-api-key'. | ||
`, | ||
) | ||
.setVersion('1.0.0') | ||
.addApiKey({ type: 'apiKey', name: 'x-api-key', in: 'header' }, 'apiKey') | ||
.build(); | ||
const document = SwaggerModule.createDocument(app, documentConfig, { | ||
include: [APIModule], | ||
}); | ||
writeFileSync('./swagger.json', JSON.stringify(document)); | ||
await app.close(); | ||
} | ||
|
||
void generateSwaggerDoc(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.