Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmeirlevy committed May 21, 2024
0 parents commit da0a69f
Show file tree
Hide file tree
Showing 9 changed files with 1,884 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker-image.yml
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 }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
cert
.idea
11 changes: 11 additions & 0 deletions Dockerfile
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# events-manager-plugin-example
86 changes: 86 additions & 0 deletions endpoints.ts
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: {}
}
})
Loading

0 comments on commit da0a69f

Please sign in to comment.