diff --git a/.eslintrc.json b/.eslintrc.json index baea138..406a9f3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,6 +25,7 @@ "@typescript-eslint/no-explicit-any": "off" }, "ignorePatterns": [ - "*.js" + "*.js", + "*gen*" ] } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bbbbc84 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build +on: + push: + branches: + - '*' + - '!main' + pull_request: + branches: + - '*' + - '!main' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + - name: Install Dependencies + run: yarn --silent + - name: Generate OpenAPI + run: | + yarn gen-api + - name: Build and Test + run: | + yarn build + + - name: Archive Artifacts + uses: actions/upload-artifact@v2 + with: + name: build + path: build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index befcd00..e9a30e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,4 +75,4 @@ jobs: prerelease: false allowUpdates: true bodyFile: CHANGELOG.md - tag: v1.0.0 \ No newline at end of file + tag: v1.1.0 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 05a0e77..32bb749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ # Changelog -Here we will write every update about this project \ No newline at end of file +- Changed SMS to API \ No newline at end of file diff --git a/openapi-config.ts b/openapi-config.ts index 4da5e1f..bae25fd 100644 --- a/openapi-config.ts +++ b/openapi-config.ts @@ -4,13 +4,13 @@ const config: ConfigFile = { schemaFile: './openapi.yaml', apiFile: './src/service/empty.api.ts', apiImport: 'emptySplitApi', - outputFile: './src/store/sms.gen.api.ts', + outputFile: './src/store/api.gen.api.ts', outputFiles: { - './src/store/sms.gen.api.ts': { - filterEndpoints: (operationName, operationDefinition) => operationDefinition.path.startsWith('/sms'), + './src/store/api.gen.api.ts': { + filterEndpoints: (operationName, operationDefinition) => operationDefinition.path.startsWith('/api'), }, }, - exportName: 'smsApi', + exportName: 'apiApi', hooks: true, } diff --git a/openapi.yaml b/openapi.yaml index e0de02d..f1dcb5b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1,8 +1,8 @@ openapi: 3.0.3 info: - title: SMS API Receiver + title: API Receiver description: |- - This is a description for the application SMS API which would mainly be a docker app. What is does, is simply a CRUD (without U) with JSON data on requests objects. So the backend is going to persist the whole request, even path and parameters. + This is a description for the application API which would mainly be a docker app. What is does, is simply a CRUD (without U) with JSON data on requests objects. So the backend is going to persist the whole request, even path and parameters. contact: email: dev@ssegning.com license: @@ -15,35 +15,35 @@ externalDocs: servers: - url: http://localhost:3000 tags: - - name: sms - description: Create, Delete and Read sms requests. + - name: api + description: Create, Delete and Read api requests. externalDocs: description: Find out more - url: https://blog.ssegning.com/tag/sms + url: https://blog.ssegning.com/tag/api - name: config description: Where we're going to add more config about the API (in the future) - name: user description: If we want to supports auth in a future, this might be helpful. paths: - /sms: + /api: post: tags: - - sms - summary: Add a new sms to the store - description: Add a new sms to the store - operationId: addSmsRequest + - api + summary: Add a new api to the store + description: Add a new api to the store + operationId: addApiRequest requestBody: - description: Create a new sms in the store + description: Create a new api in the store content: application/json: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' application/xml: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' required: true responses: '200': @@ -51,22 +51,22 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' application/xml: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' '405': description: Invalid input security: - - sms_auth: - - write:sms - - read:sms + - api_auth: + - write:api + - read:api get: tags: - - sms - summary: Finds SmsRequest + - api + summary: Finds ApiRequest description: Multiple status values can be provided with comma separated strings - operationId: getSmsRequests + operationId: getApiRequests parameters: - name: query in: query @@ -102,29 +102,29 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SmsRequestPage' + $ref: '#/components/schemas/ApiRequestPage' application/xml: schema: type: array items: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' '400': description: Invalid status value security: - - sms_auth: - - write:sms - - read:sms - /sms/{smsRequestId}: + - api_auth: + - write:api + - read:api + /api/{apiRequestId}: get: tags: - - sms - summary: Find sms by ID - description: Returns a single sms - operationId: getAnSmsRequest + - api + summary: Find api by ID + description: Returns a single api + operationId: getAnApiRequest parameters: - - name: smsRequestId + - name: apiRequestId in: path - description: ID of sms to return + description: ID of api to return required: true schema: type: string @@ -134,28 +134,28 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' application/xml: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' '400': description: Invalid ID supplied '404': - description: Sms Request not found + description: Api Request not found security: - - sms_auth: - - write:sms - - read:sms + - api_auth: + - write:api + - read:api delete: tags: - - sms - summary: Deletes a sms - description: delete a sms - operationId: deleteSmsRequest + - api + summary: Deletes a api + description: delete a api + operationId: deleteApiRequest parameters: - - name: smsRequestId + - name: apiRequestId in: path - description: Sms Request id to delete + description: Api Request id to delete required: true schema: type: string @@ -165,23 +165,23 @@ paths: '404': description: Request not found security: - - sms_auth: - - write:sms - - read:sms + - api_auth: + - write:api + - read:api components: schemas: - SmsRequestValue: + ApiRequestValue: oneOf: - type: string - type: number - - $ref: '#/components/schemas/SmsRequest' - SmsRequest: + - $ref: '#/components/schemas/ApiRequest' + ApiRequest: type: object additionalProperties: - $ref: '#/components/schemas/SmsRequestValue' + $ref: '#/components/schemas/ApiRequestValue' xml: - name: sms_request - SmsRequestPage: + name: api_request + ApiRequestPage: type: object required: - content @@ -190,7 +190,7 @@ components: content: type: array items: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' meta: $ref: '#/components/schemas/PageMeta' PageMeta: @@ -207,17 +207,17 @@ components: total: type: number requestBodies: - SmsRequest: - description: SmsRequest object that needs to be added to the store + ApiRequest: + description: ApiRequest object that needs to be added to the store content: application/json: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' application/xml: schema: - $ref: '#/components/schemas/SmsRequest' + $ref: '#/components/schemas/ApiRequest' securitySchemes: - sms_auth: + api_auth: type: apiKey name: api_key in: header \ No newline at end of file diff --git a/package.json b/package.json index 6d0d6b5..37d3b60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "sms-reader-frontend", - "version": "0.1.0", + "name": "api-reader-frontend", + "version": "0.2.0", "private": true, "dependencies": { "@headlessui/react": "^1.7.13", diff --git a/public/icons/site.webmanifest b/public/icons/site.webmanifest index 3986fe1..814d080 100644 --- a/public/icons/site.webmanifest +++ b/public/icons/site.webmanifest @@ -1,6 +1,6 @@ { - "name": "SMS Request Watcher", - "short_name": "SMS Watcher", + "name": "Request Watcher", + "short_name": "Watcher", "icons": [ { "src": "/icons/android-chrome-192x192.png", diff --git a/public/index.html b/public/index.html index fe9406e..8336835 100644 --- a/public/index.html +++ b/public/index.html @@ -17,9 +17,9 @@ -