diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index 606e141..6e78d40 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -3,18 +3,18 @@ on: [workflow_dispatch] jobs: codemakerai_generation_job: runs-on: ubuntu-latest - name: A job to run codemakerai code generation + name: A job to run codemakerai documentation generation steps: - name: Checkout - uses: actions/checkout@v3 - - name: Code generation - uses: codemakerai/codemaker-action@v1.2.0 + uses: actions/checkout@v4 + - name: Documentation generation + uses: codemakerai/codemaker-action@v1.5.0 with: api-key: ${{ secrets.CODEMAKER_API_KEY }} - mode: code # code, docs or unit-tests - path: app/src/main/java/ai/codemaker/demo/dao/*.java + mode: docs # code, docs + path: app/src/main/js/app.all.js - name: Create Pull Request - uses: peter-evans/create-pull-request@v5.0.2 + uses: peter-evans/create-pull-request@v6 with: commit-message: Code generated by codemaker title: Changes by codemaker-action diff --git a/app/src/main/java/ai/codemaker/demo/dao/CrudDao.java b/app/src/main/java/ai/codemaker/demo/dao/CrudDao.java deleted file mode 100644 index a4cc485..0000000 --- a/app/src/main/java/ai/codemaker/demo/dao/CrudDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package ai.codemaker.demo.dao; - -public interface CrudDao { - - void save(T entity); - - void update(T entity); -} diff --git a/app/src/main/java/ai/codemaker/demo/dao/OrderDao.java b/app/src/main/java/ai/codemaker/demo/dao/OrderDao.java deleted file mode 100644 index 3ea42e7..0000000 --- a/app/src/main/java/ai/codemaker/demo/dao/OrderDao.java +++ /dev/null @@ -1,56 +0,0 @@ -package ai.codemaker.demo.dao; - -import ai.codemaker.demo.domain.Order; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class OrderDao implements CrudDao { - - private final Session session; - - private static final Logger logger = LoggerFactory.getLogger(OrderDao.class); - - public OrderDao(Session session) { - this.session = session; - } - - /** - * Saves the given {@link Order} to the database. - * - * @param order The {@link Order} to save. Must not be null. - * @throws IllegalArgumentException if Order is null. - * @throws HibernateException if an error occurs while saving the Order. - */ - public void save(Order order) { - - } - - /** - * Updates the given {@link Order} object. - * - * @param order The {@link Order} object to be updated. - */ - public void update(Order order) { - - } - - /** - * Retrieves the Order from the database. - * - * @return Order the Order or null - */ - public Order get(String id) { - return null; - } - - /** - * Deletes the Order from the database. - * - * @param order Order to save - */ - public void delete(Order order) { - - } -} diff --git a/app/src/main/java/ai/codemaker/demo/dao/PaymentDao.java b/app/src/main/java/ai/codemaker/demo/dao/PaymentDao.java deleted file mode 100644 index 8d8fb78..0000000 --- a/app/src/main/java/ai/codemaker/demo/dao/PaymentDao.java +++ /dev/null @@ -1,58 +0,0 @@ -package ai.codemaker.demo.dao; - -import ai.codemaker.demo.domain.Payment; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.hibernate.Transaction; -import org.hibernate.query.Query; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PaymentDao implements CrudDao { - - private final Session session; - - private static final Logger logger = LoggerFactory.getLogger(PaymentDao.class); - - public PaymentDao(Session session) { - this.session = session; - } - - /** - * Saves the given {@link Payment} to the database. - * - * @param payment The {@link Payment} to save. Must not be null. - * @throws IllegalArgumentException if payment is null. - * @throws HibernateException if an error occurs while saving the payment. - */ - public void save(Payment payment) { - - } - - /** - * Updates the given {@link Payment} object. - * - * @param payment The {@link Payment} object to be updated. - */ - public void update(Payment payment) { - - } - - /** - * Retrieves the payment from the database. - * - * @return payment the payment or null - */ - public Payment get(String id) { - return null; - } - - /** - * Deletes the payment from the database. - * - * @param payment payment to save - */ - public void delete(Payment payment) { - - } -} diff --git a/app/src/main/java/ai/codemaker/demo/domain/Order.java b/app/src/main/java/ai/codemaker/demo/domain/Order.java deleted file mode 100644 index 8cbc9ae..0000000 --- a/app/src/main/java/ai/codemaker/demo/domain/Order.java +++ /dev/null @@ -1,57 +0,0 @@ -package ai.codemaker.demo.domain; - -import java.time.Instant; -import java.util.Collection; - -public class Order { - - private String id; - - private String customerId; - - private String addressId; - - private Collection productsIds; - - private Instant createDate; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getCustomerId() { - return customerId; - } - - public void setCustomerId(String customerId) { - this.customerId = customerId; - } - - public String getAddressId() { - return addressId; - } - - public void setAddressId(String addressId) { - this.addressId = addressId; - } - - public Collection getProductsIds() { - return productsIds; - } - - public void setProductsIds(Collection productsIds) { - this.productsIds = productsIds; - } - - public Instant getCreateDate() { - return createDate; - } - - public void setCreateDate(Instant createDate) { - this.createDate = createDate; - } -} diff --git a/app/src/main/java/ai/codemaker/demo/domain/Payment.java b/app/src/main/java/ai/codemaker/demo/domain/Payment.java deleted file mode 100644 index d125539..0000000 --- a/app/src/main/java/ai/codemaker/demo/domain/Payment.java +++ /dev/null @@ -1,46 +0,0 @@ -package ai.codemaker.demo.domain; - -import java.time.Instant; - -public class Payment { - - private String id; - - private String orderId; - - private double amount; - - private Instant createDate; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getOrderId() { - return orderId; - } - - public void setOrderId(String orderId) { - this.orderId = orderId; - } - - public double getAmount() { - return amount; - } - - public void setAmount(double amount) { - this.amount = amount; - } - - public Instant getCreateDate() { - return createDate; - } - - public void setCreateDate(Instant createDate) { - this.createDate = createDate; - } -} diff --git a/app/src/main/js/app.all.js b/app/src/main/js/app.all.js new file mode 100644 index 0000000..0c3d087 --- /dev/null +++ b/app/src/main/js/app.all.js @@ -0,0 +1,38 @@ +'use strict' + +var after = require('after') +var express = require('../') + , request = require('supertest'); + +describe('app.all()', function(){ + it('should add a router per method', function(done){ + var app = express(); + var cb = after(2, done) + + app.all('/tobi', function(req, res){ + res.end(req.method); + }); + + request(app) + .put('/tobi') + .expect(200, 'PUT', cb) + + request(app) + .get('/tobi') + .expect(200, 'GET', cb) + }) + + it('should run the callback for a method just once', function(done){ + var app = express() + , n = 0; + + app.all('/*', function(req, res, next){ + if (n++) return done(new Error('DELETE called several times')); + next(); + }); + + request(app) + .del('/tobi') + .expect(404, done); + }) +}) diff --git a/app/src/test/java/ai/codemaker/PaymentDaoTest.java b/app/src/test/java/ai/codemaker/PaymentDaoTest.java deleted file mode 100644 index 2ea4342..0000000 --- a/app/src/test/java/ai/codemaker/PaymentDaoTest.java +++ /dev/null @@ -1,11 +0,0 @@ -package app.src.test.java.ai.codemaker; - -import org.junit.jupiter.api.Test; - -public class PaymentDaoTest { - - @Test - public void test() { - - } -}