-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit da0a69f
Showing
9 changed files
with
1,884 additions
and
0 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,39 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
push_to_registries: | ||
name: Push Docker image to multiple registries | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository }} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,3 @@ | ||
node_modules | ||
cert | ||
.idea |
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,11 @@ | ||
FROM node:20.6-slim | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN npm run build:cd | ||
|
||
ENV NODE_ENV=production | ||
|
||
CMD npm start |
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 @@ | ||
# events-manager-plugin-example |
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,86 @@ | ||
import { createCrud } from '@qelos/plugin-play' | ||
import { collections, EventDoc } from './services/db'; | ||
import { ObjectId } from 'mongodb'; | ||
|
||
const events = collections.events; | ||
|
||
createCrud<EventDoc>({ | ||
display: { | ||
name: 'event' | ||
}, | ||
verify: async (req) => { | ||
return true; | ||
}, | ||
readOne: (_id, { tenantPayload }) => events.findOne({ _id: new ObjectId(_id), tenant: tenantPayload.sub }), | ||
createOne: async (body, { user }) => { | ||
const data: any = { ...body, user: user._id }; | ||
const res = await events.insertOne(data); | ||
data._id = res.insertedId; | ||
return data; | ||
}, | ||
readMany: (query, { tenantPayload }) => events.find({ tenant: tenantPayload.sub, tags: query.tags }).toArray(), | ||
updateOne: async (_id, body: EventDoc, { user, tenantPayload }) => { | ||
await events.updateOne({ | ||
_id: new ObjectId(_id), | ||
user: user._id, | ||
tenant: tenantPayload.sub | ||
}, { $set: body }) | ||
return { | ||
...body, | ||
_id | ||
}; | ||
}, | ||
deleteOne: async (_id, { user, tenantPayload }) => { | ||
const item = await events.findOne({ | ||
_id: new ObjectId(_id), | ||
user: user._id, | ||
tenant: tenantPayload.sub | ||
}) | ||
await events.deleteOne({ | ||
_id: new ObjectId(_id), | ||
user: user._id, | ||
tenant: tenantPayload.sub | ||
}); | ||
return item | ||
}, | ||
schema: { | ||
title: { | ||
type: String, | ||
public: true | ||
}, | ||
scheduledTo: { | ||
type: Date, | ||
public: true | ||
}, | ||
description: { | ||
type: String, | ||
public: true | ||
}, | ||
location: { | ||
type: { | ||
lat: Number, | ||
lng: Number, | ||
description: String | ||
}, | ||
public: true | ||
}, | ||
tags: { | ||
type: [String], | ||
public: true | ||
} | ||
}, | ||
screens: { | ||
create: { | ||
structure: ` | ||
<h1>Create an event</h1> | ||
<FormRowGroup> | ||
<FormInput v-model="row.title" title="Title" /> | ||
<FormInput v-model="row.description" title="Description" /> | ||
</FormRowGroup> | ||
` | ||
}, | ||
edit: {}, | ||
list: {}, | ||
view: {} | ||
} | ||
}) |
Oops, something went wrong.