Skip to content

Commit

Permalink
[Shared] Extract models to shared package
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeisb committed Nov 29, 2023
1 parent 09aead2 commit 9960133
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/publish-shared-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Shared Package

on:
push:
paths:
- 'packages/shared/**'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm i
working-directory: packages/shared
- uses: JS-DevTools/npm-publish@v3
with:
package: packages/shared
token: ${{ secrets.GITHUB_TOKEN }}
registry: "https://npm.pkg.github.com/ls1intum"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "root",
"name": "uicompanion",
"private": true,
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "UICompanion",
"name": "uicompanion-app",
"version": "1.0.0",
"scripts": {
"build": "tsc --build",
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"name": "figma-plugin-react-template",
"name": "uicompanion-plugin",
"version": "1.0.0",
"description": "This plugin template uses Typescript. If you are familiar with Javascript, Typescript will look very familiar. In fact, valid Javascript code is already valid Typescript code.",
"license": "ISC",
"scripts": {
"build": "webpack --mode=production",
"start": "webpack --mode=production --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "uicompanionserver",
"name": "uicompanion-server",
"version": "1.0.0",
"description": "",
"scripts": {
Expand Down
54 changes: 54 additions & 0 deletions packages/uicompanion-shared/models/Issue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Document, Schema, Model, model, Error } from 'mongoose'

export interface Issue {
repository_url: string;
number: number;
title: string;
description: string;
status: string;
frames: string[];
prototypeUrls: string[];
}

export interface IIssue extends Document {
repository_url: string;
number: number;
title: string;
description: string;
status: string;
frames: string[];
prototypeUrls: string[];
}

export const issueSchema = new Schema({
repository_url: {
type: String,
required: true,
},
number: {
type: Number,
required: true,
unique: true,
},
title: {
type: String,
required: true,
},
description: {
type: String,
required: false,
},
status: {
type: String,
required: true,
enum: ['Open', 'In Progress', 'In Review', 'Approved'],
},
frames: {
type: [String],
required: true,
},
prototypeUrls: {
type: [String],
required: true,
},
});
13 changes: 13 additions & 0 deletions packages/uicompanion-shared/models/IssueStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export enum IssueStatus {
OPEN = 'Open',
IN_PROGRESS = 'In Progress',
IN_REVIEW = 'In Review',
APPROVED = 'Approved'
}

export const issueStatusToIndex: Record<IssueStatus, number> = {
[IssueStatus.OPEN]: 0,
[IssueStatus.IN_PROGRESS]: 1,
[IssueStatus.IN_REVIEW]: 2,
[IssueStatus.APPROVED]: 3
};
18 changes: 18 additions & 0 deletions packages/uicompanion-shared/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@ls1intum/uicompanion-shared",
"version": "1.0.0",
"description": "",
"repository": "https://github.com/ls1intum/UICompanion.git",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"mongoose": "^8.0.2"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/ls1intum"
}
}

0 comments on commit 9960133

Please # to comment.