@sundaysf/cli-v2 1.0.1 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -178
- package/dist/README.md +178 -178
- package/dist/bin/generators/class.js.map +1 -1
- package/dist/bin/generators/postman.js.map +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/templates/backend/.claude/agents/knex-table-implementer.md +113 -113
- package/dist/templates/backend/.claude/agents/sundays-backend-builder.md +70 -70
- package/dist/templates/backend/.claude/settings.local.json +13 -13
- package/dist/templates/backend/.env.example +13 -13
- package/dist/templates/backend/.prettierignore +2 -2
- package/dist/templates/backend/.prettierrc +9 -9
- package/dist/templates/backend/.sundaysrc +7 -0
- package/dist/templates/backend/CLAUDE.md +348 -348
- package/dist/templates/backend/Dockerfile +14 -14
- package/dist/templates/backend/README.md +18 -18
- package/dist/templates/backend/eslint.config.js +20 -20
- package/dist/templates/backend/src/app.ts +34 -34
- package/dist/templates/backend/src/common/config/origins/origins.config.ts +11 -11
- package/dist/templates/backend/src/common/utils/environment.resolver.ts +3 -3
- package/dist/templates/backend/src/common/utils/version.resolver.ts +4 -4
- package/dist/templates/backend/src/controllers/health/health.controller.ts +23 -23
- package/dist/templates/backend/src/middlewares/error/error.middleware.ts +21 -21
- package/dist/templates/backend/src/routes/health/health.router.ts +16 -16
- package/dist/templates/backend/src/routes/index.ts +57 -57
- package/dist/templates/backend/src/server.ts +16 -16
- package/dist/templates/backend/src/types.d.ts +10 -10
- package/dist/templates/backend/tsconfig.json +16 -16
- package/dist/templates/backend-db-sql/.claude/agents/knex-table-implementer.md +114 -114
- package/dist/templates/backend-db-sql/.claude/agents/sundays-backend-builder.md +70 -70
- package/dist/templates/backend-db-sql/.claude/settings.local.json +19 -19
- package/dist/templates/backend-db-sql/.env.example +13 -13
- package/dist/templates/backend-db-sql/.prettierignore +2 -2
- package/dist/templates/backend-db-sql/.prettierrc +9 -9
- package/dist/templates/backend-db-sql/.sundaysrc +7 -0
- package/dist/templates/backend-db-sql/CLAUDE.md +374 -374
- package/dist/templates/backend-db-sql/Dockerfile +17 -17
- package/dist/templates/backend-db-sql/README.md +34 -34
- package/dist/templates/backend-db-sql/db/knexfile.ts +33 -33
- package/dist/templates/backend-db-sql/db/migrations/001_create_sundays_package_version.ts +12 -12
- package/dist/templates/backend-db-sql/db/seeds/001_sundays_package_version_seed.ts +10 -10
- package/dist/templates/backend-db-sql/db/src/KnexConnection.ts +74 -74
- package/dist/templates/backend-db-sql/db/src/d.types.ts +18 -18
- package/dist/templates/backend-db-sql/db/src/dao/sundays-package-version/sundays-package-version.dao.ts +71 -71
- package/dist/templates/backend-db-sql/db/src/index.ts +9 -9
- package/dist/templates/backend-db-sql/db/src/interfaces/sundays-package-version/sundays-package-version.interfaces.ts +6 -6
- package/dist/templates/backend-db-sql/db/tsconfig.json +16 -16
- package/dist/templates/backend-db-sql/eslint.config.js +20 -20
- package/dist/templates/backend-db-sql/src/app.ts +34 -34
- package/dist/templates/backend-db-sql/src/common/config/origins/origins.config.ts +11 -11
- package/dist/templates/backend-db-sql/src/common/utils/environment.resolver.ts +3 -3
- package/dist/templates/backend-db-sql/src/common/utils/version.resolver.ts +4 -4
- package/dist/templates/backend-db-sql/src/controllers/health/health.controller.ts +23 -23
- package/dist/templates/backend-db-sql/src/middlewares/error/error.middleware.ts +21 -21
- package/dist/templates/backend-db-sql/src/routes/health/health.router.ts +16 -16
- package/dist/templates/backend-db-sql/src/routes/index.ts +57 -57
- package/dist/templates/backend-db-sql/src/server.ts +18 -18
- package/dist/templates/backend-db-sql/src/types.d.ts +10 -10
- package/dist/templates/backend-db-sql/tsconfig.json +16 -16
- package/dist/templates/backend-embedded-db-sql/.claude/agents/knex-table-implementer.md +116 -0
- package/dist/templates/backend-embedded-db-sql/.claude/agents/sundays-backend-builder.md +70 -0
- package/dist/templates/backend-embedded-db-sql/.claude/settings.local.json +18 -0
- package/dist/templates/backend-embedded-db-sql/.env.example +14 -0
- package/dist/templates/backend-embedded-db-sql/.prettierignore +3 -0
- package/dist/templates/backend-embedded-db-sql/.prettierrc +9 -0
- package/dist/templates/backend-embedded-db-sql/.sundaysrc +7 -0
- package/dist/templates/backend-embedded-db-sql/CLAUDE.md +371 -0
- package/dist/templates/backend-embedded-db-sql/Dockerfile +14 -0
- package/dist/templates/backend-embedded-db-sql/README.md +32 -0
- package/dist/templates/backend-embedded-db-sql/eslint.config.js +20 -0
- package/dist/templates/backend-embedded-db-sql/knexfile.ts +37 -0
- package/dist/templates/backend-embedded-db-sql/migrations/.gitkeep +0 -0
- package/dist/templates/backend-embedded-db-sql/migrations/001_create_sundays_package_version.ts +13 -0
- package/dist/templates/backend-embedded-db-sql/seeds/001_sundays_package_version_seed.ts +11 -0
- package/dist/templates/backend-embedded-db-sql/src/app.ts +35 -0
- package/dist/templates/backend-embedded-db-sql/src/common/config/origins/origins.config.ts +11 -0
- package/dist/templates/backend-embedded-db-sql/src/common/utils/environment.resolver.ts +4 -0
- package/dist/templates/backend-embedded-db-sql/src/common/utils/version.resolver.ts +5 -0
- package/dist/templates/backend-embedded-db-sql/src/controllers/health/health.controller.ts +24 -0
- package/dist/templates/backend-embedded-db-sql/src/db/KnexConnection.ts +74 -0
- package/dist/templates/backend-embedded-db-sql/src/db/d.types.ts +18 -0
- package/dist/templates/backend-embedded-db-sql/src/db/dao/sundays-package-version/sundays-package-version.dao.ts +71 -0
- package/dist/templates/backend-embedded-db-sql/src/db/index.ts +9 -0
- package/dist/templates/backend-embedded-db-sql/src/db/interfaces/sundays-package-version/sundays-package-version.interfaces.ts +6 -0
- package/dist/templates/backend-embedded-db-sql/src/middlewares/error/error.middleware.ts +21 -0
- package/dist/templates/backend-embedded-db-sql/src/routes/health/health.router.ts +17 -0
- package/dist/templates/backend-embedded-db-sql/src/routes/index.ts +57 -0
- package/dist/templates/backend-embedded-db-sql/src/server.ts +18 -0
- package/dist/templates/backend-embedded-db-sql/src/types.d.ts +10 -0
- package/dist/templates/backend-embedded-db-sql/tsconfig.json +16 -0
- package/dist/templates/db-sql/.claude/agents/knex-table-implementer.md +113 -113
- package/dist/templates/db-sql/.claude/agents/sundays-backend-builder.md +70 -70
- package/dist/templates/db-sql/.claude/settings.local.json +10 -10
- package/dist/templates/db-sql/.env.example +8 -8
- package/dist/templates/db-sql/CLAUDE.md +105 -105
- package/dist/templates/db-sql/knexfile.ts +33 -33
- package/dist/templates/db-sql/migrations/001_create_sundays_package_version.ts +12 -12
- package/dist/templates/db-sql/seeds/001_sundays_package_version_seed.ts +10 -10
- package/dist/templates/db-sql/src/KnexConnection.ts +74 -74
- package/dist/templates/db-sql/src/d.types.ts +18 -18
- package/dist/templates/db-sql/src/dao/sundays-package-version/sundays-package-version.dao.ts +71 -71
- package/dist/templates/db-sql/src/index.ts +9 -9
- package/dist/templates/db-sql/src/interfaces/sundays-package-version/sundays-package-version.interfaces.ts +6 -6
- package/dist/templates/db-sql/tsconfig.json +16 -16
- package/dist/templates/frontend-nextjs/.sundaysrc +7 -0
- package/dist/templates/frontend-nextjs/app/globals.css +125 -0
- package/dist/templates/frontend-nextjs/app/layout.tsx +45 -0
- package/dist/templates/frontend-nextjs/app/page.tsx +5 -0
- package/dist/templates/frontend-nextjs/components/project-generator.tsx +558 -0
- package/dist/templates/frontend-nextjs/components/theme-provider.tsx +11 -0
- package/dist/templates/frontend-nextjs/components/ui/accordion.tsx +66 -0
- package/dist/templates/frontend-nextjs/components/ui/alert-dialog.tsx +157 -0
- package/dist/templates/frontend-nextjs/components/ui/alert.tsx +66 -0
- package/dist/templates/frontend-nextjs/components/ui/aspect-ratio.tsx +11 -0
- package/dist/templates/frontend-nextjs/components/ui/avatar.tsx +53 -0
- package/dist/templates/frontend-nextjs/components/ui/badge.tsx +46 -0
- package/dist/templates/frontend-nextjs/components/ui/breadcrumb.tsx +109 -0
- package/dist/templates/frontend-nextjs/components/ui/button-group.tsx +83 -0
- package/dist/templates/frontend-nextjs/components/ui/button.tsx +60 -0
- package/dist/templates/frontend-nextjs/components/ui/calendar.tsx +213 -0
- package/dist/templates/frontend-nextjs/components/ui/card.tsx +92 -0
- package/dist/templates/frontend-nextjs/components/ui/carousel.tsx +241 -0
- package/dist/templates/frontend-nextjs/components/ui/chart.tsx +353 -0
- package/dist/templates/frontend-nextjs/components/ui/checkbox.tsx +32 -0
- package/dist/templates/frontend-nextjs/components/ui/collapsible.tsx +33 -0
- package/dist/templates/frontend-nextjs/components/ui/command.tsx +184 -0
- package/dist/templates/frontend-nextjs/components/ui/context-menu.tsx +252 -0
- package/dist/templates/frontend-nextjs/components/ui/dialog.tsx +143 -0
- package/dist/templates/frontend-nextjs/components/ui/drawer.tsx +135 -0
- package/dist/templates/frontend-nextjs/components/ui/dropdown-menu.tsx +257 -0
- package/dist/templates/frontend-nextjs/components/ui/empty.tsx +104 -0
- package/dist/templates/frontend-nextjs/components/ui/field.tsx +244 -0
- package/dist/templates/frontend-nextjs/components/ui/form.tsx +167 -0
- package/dist/templates/frontend-nextjs/components/ui/hover-card.tsx +44 -0
- package/dist/templates/frontend-nextjs/components/ui/input-group.tsx +169 -0
- package/dist/templates/frontend-nextjs/components/ui/input-otp.tsx +77 -0
- package/dist/templates/frontend-nextjs/components/ui/input.tsx +21 -0
- package/dist/templates/frontend-nextjs/components/ui/item.tsx +193 -0
- package/dist/templates/frontend-nextjs/components/ui/kbd.tsx +28 -0
- package/dist/templates/frontend-nextjs/components/ui/label.tsx +24 -0
- package/dist/templates/frontend-nextjs/components/ui/menubar.tsx +276 -0
- package/dist/templates/frontend-nextjs/components/ui/navigation-menu.tsx +166 -0
- package/dist/templates/frontend-nextjs/components/ui/pagination.tsx +127 -0
- package/dist/templates/frontend-nextjs/components/ui/popover.tsx +48 -0
- package/dist/templates/frontend-nextjs/components/ui/progress.tsx +31 -0
- package/dist/templates/frontend-nextjs/components/ui/radio-group.tsx +45 -0
- package/dist/templates/frontend-nextjs/components/ui/resizable.tsx +56 -0
- package/dist/templates/frontend-nextjs/components/ui/scroll-area.tsx +58 -0
- package/dist/templates/frontend-nextjs/components/ui/select.tsx +185 -0
- package/dist/templates/frontend-nextjs/components/ui/separator.tsx +28 -0
- package/dist/templates/frontend-nextjs/components/ui/sheet.tsx +139 -0
- package/dist/templates/frontend-nextjs/components/ui/sidebar.tsx +726 -0
- package/dist/templates/frontend-nextjs/components/ui/skeleton.tsx +13 -0
- package/dist/templates/frontend-nextjs/components/ui/slider.tsx +63 -0
- package/dist/templates/frontend-nextjs/components/ui/sonner.tsx +25 -0
- package/dist/templates/frontend-nextjs/components/ui/spinner.tsx +16 -0
- package/dist/templates/frontend-nextjs/components/ui/switch.tsx +31 -0
- package/dist/templates/frontend-nextjs/components/ui/table.tsx +116 -0
- package/dist/templates/frontend-nextjs/components/ui/tabs.tsx +66 -0
- package/dist/templates/frontend-nextjs/components/ui/textarea.tsx +18 -0
- package/dist/templates/frontend-nextjs/components/ui/toast.tsx +129 -0
- package/dist/templates/frontend-nextjs/components/ui/toaster.tsx +35 -0
- package/dist/templates/frontend-nextjs/components/ui/toggle-group.tsx +73 -0
- package/dist/templates/frontend-nextjs/components/ui/toggle.tsx +47 -0
- package/dist/templates/frontend-nextjs/components/ui/tooltip.tsx +61 -0
- package/dist/templates/frontend-nextjs/components/ui/use-mobile.tsx +19 -0
- package/dist/templates/frontend-nextjs/components/ui/use-toast.ts +191 -0
- package/dist/templates/frontend-nextjs/components.json +21 -0
- package/dist/templates/frontend-nextjs/hooks/use-mobile.ts +19 -0
- package/dist/templates/frontend-nextjs/hooks/use-toast.ts +191 -0
- package/dist/templates/frontend-nextjs/lib/utils.ts +6 -0
- package/dist/templates/frontend-nextjs/next.config.mjs +11 -0
- package/dist/templates/frontend-nextjs/postcss.config.mjs +8 -0
- package/dist/templates/frontend-nextjs/public/apple-icon.png +0 -0
- package/dist/templates/frontend-nextjs/public/icon-dark-32x32.png +0 -0
- package/dist/templates/frontend-nextjs/public/icon-light-32x32.png +0 -0
- package/dist/templates/frontend-nextjs/public/icon.svg +26 -0
- package/dist/templates/frontend-nextjs/public/placeholder-logo.png +0 -0
- package/dist/templates/frontend-nextjs/public/placeholder-logo.svg +1 -0
- package/dist/templates/frontend-nextjs/public/placeholder-user.jpg +0 -0
- package/dist/templates/frontend-nextjs/public/placeholder.jpg +0 -0
- package/dist/templates/frontend-nextjs/public/placeholder.svg +1 -0
- package/dist/templates/frontend-nextjs/styles/globals.css +125 -0
- package/dist/templates/frontend-nextjs/tsconfig.json +27 -0
- package/dist/templates/module/.claude/agents/knex-table-implementer.md +113 -113
- package/dist/templates/module/.claude/agents/sundays-backend-builder.md +70 -70
- package/dist/templates/module/.claude/settings.local.json +10 -10
- package/dist/templates/module/CLAUDE.md +158 -158
- package/dist/templates/module/src/index.ts +9 -9
- package/dist/templates/module/tsconfig.json +19 -19
- package/package.json +40 -40
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { knex, Knex } from 'knex';
|
|
2
|
-
|
|
3
|
-
class KnexManager {
|
|
4
|
-
private static knexInstance: Knex<any, unknown[]> | null = null;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Open a new connection. Reuse the already existing one if there's any.
|
|
8
|
-
*/
|
|
9
|
-
static async connect(
|
|
10
|
-
config?: Knex.Config,
|
|
11
|
-
connections?: number
|
|
12
|
-
): Promise<Knex<any, unknown[]>> {
|
|
13
|
-
if (!KnexManager.knexInstance) {
|
|
14
|
-
const isLocalhost = process.env.SQL_HOST === 'localhost' || process.env.SQL_HOST === '127.0.0.1';
|
|
15
|
-
const rejectUnauthorized = process.env.SQL_REJECT_UNAUTHORIZED !== 'false';
|
|
16
|
-
const defaultConfig = {
|
|
17
|
-
client: 'pg',
|
|
18
|
-
connection: {
|
|
19
|
-
host: process.env.SQL_HOST,
|
|
20
|
-
user: process.env.SQL_USER,
|
|
21
|
-
password: process.env.SQL_PASSWORD,
|
|
22
|
-
database: process.env.SQL_DB_NAME,
|
|
23
|
-
port: Number(process.env.SQL_PORT) || 5432,
|
|
24
|
-
ssl: isLocalhost ? false : { rejectUnauthorized },
|
|
25
|
-
},
|
|
26
|
-
pool: {
|
|
27
|
-
min: 1,
|
|
28
|
-
max: connections || 15,
|
|
29
|
-
idleTimeoutMillis: 20000,
|
|
30
|
-
acquireTimeoutMillis: 30000,
|
|
31
|
-
},
|
|
32
|
-
migrations: {
|
|
33
|
-
tableName: 'knex_migrations',
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
KnexManager.knexInstance = knex(config || defaultConfig);
|
|
37
|
-
try {
|
|
38
|
-
await KnexManager.knexInstance.raw('SELECT 1');
|
|
39
|
-
console.info(`Knex connection established`);
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error(`Failed to establish Knex connection:`, error);
|
|
42
|
-
KnexManager.knexInstance = null;
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return KnexManager.knexInstance;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Returns the active connection.
|
|
52
|
-
*/
|
|
53
|
-
static getConnection(): Knex<any, unknown[]> {
|
|
54
|
-
if (!KnexManager.knexInstance) {
|
|
55
|
-
throw new Error(
|
|
56
|
-
'Knex connection has not been established. Call connect() first.'
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
return KnexManager.knexInstance;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Closes the connection and destroys the instance.
|
|
64
|
-
*/
|
|
65
|
-
static async disconnect(): Promise<void> {
|
|
66
|
-
if (KnexManager.knexInstance) {
|
|
67
|
-
await KnexManager.knexInstance.destroy();
|
|
68
|
-
KnexManager.knexInstance = null;
|
|
69
|
-
console.info(`Knex connection closed`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export default KnexManager;
|
|
1
|
+
import { knex, Knex } from 'knex';
|
|
2
|
+
|
|
3
|
+
class KnexManager {
|
|
4
|
+
private static knexInstance: Knex<any, unknown[]> | null = null;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Open a new connection. Reuse the already existing one if there's any.
|
|
8
|
+
*/
|
|
9
|
+
static async connect(
|
|
10
|
+
config?: Knex.Config,
|
|
11
|
+
connections?: number
|
|
12
|
+
): Promise<Knex<any, unknown[]>> {
|
|
13
|
+
if (!KnexManager.knexInstance) {
|
|
14
|
+
const isLocalhost = process.env.SQL_HOST === 'localhost' || process.env.SQL_HOST === '127.0.0.1';
|
|
15
|
+
const rejectUnauthorized = process.env.SQL_REJECT_UNAUTHORIZED !== 'false';
|
|
16
|
+
const defaultConfig = {
|
|
17
|
+
client: 'pg',
|
|
18
|
+
connection: {
|
|
19
|
+
host: process.env.SQL_HOST,
|
|
20
|
+
user: process.env.SQL_USER,
|
|
21
|
+
password: process.env.SQL_PASSWORD,
|
|
22
|
+
database: process.env.SQL_DB_NAME,
|
|
23
|
+
port: Number(process.env.SQL_PORT) || 5432,
|
|
24
|
+
ssl: isLocalhost ? false : { rejectUnauthorized },
|
|
25
|
+
},
|
|
26
|
+
pool: {
|
|
27
|
+
min: 1,
|
|
28
|
+
max: connections || 15,
|
|
29
|
+
idleTimeoutMillis: 20000,
|
|
30
|
+
acquireTimeoutMillis: 30000,
|
|
31
|
+
},
|
|
32
|
+
migrations: {
|
|
33
|
+
tableName: 'knex_migrations',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
KnexManager.knexInstance = knex(config || defaultConfig);
|
|
37
|
+
try {
|
|
38
|
+
await KnexManager.knexInstance.raw('SELECT 1');
|
|
39
|
+
console.info(`Knex connection established`);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error(`Failed to establish Knex connection:`, error);
|
|
42
|
+
KnexManager.knexInstance = null;
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return KnexManager.knexInstance;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the active connection.
|
|
52
|
+
*/
|
|
53
|
+
static getConnection(): Knex<any, unknown[]> {
|
|
54
|
+
if (!KnexManager.knexInstance) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
'Knex connection has not been established. Call connect() first.'
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return KnexManager.knexInstance;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Closes the connection and destroys the instance.
|
|
64
|
+
*/
|
|
65
|
+
static async disconnect(): Promise<void> {
|
|
66
|
+
if (KnexManager.knexInstance) {
|
|
67
|
+
await KnexManager.knexInstance.destroy();
|
|
68
|
+
KnexManager.knexInstance = null;
|
|
69
|
+
console.info(`Knex connection closed`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default KnexManager;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export interface IBaseDAO<T> {
|
|
2
|
-
create(item: T): Promise<T>;
|
|
3
|
-
getById(id: number): Promise<T | null>;
|
|
4
|
-
getByUuid(uuid: string): Promise<T | null>;
|
|
5
|
-
update(id: number, item: Partial<T>): Promise<T | null>;
|
|
6
|
-
delete(id: number): Promise<boolean>;
|
|
7
|
-
getAll(page: number, limit: number): Promise<IDataPaginator<T>>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface IDataPaginator<T> {
|
|
11
|
-
success: boolean;
|
|
12
|
-
data: T[];
|
|
13
|
-
page: number;
|
|
14
|
-
limit: number;
|
|
15
|
-
count: number;
|
|
16
|
-
totalCount: number;
|
|
17
|
-
totalPages: number;
|
|
18
|
-
}
|
|
1
|
+
export interface IBaseDAO<T> {
|
|
2
|
+
create(item: T): Promise<T>;
|
|
3
|
+
getById(id: number): Promise<T | null>;
|
|
4
|
+
getByUuid(uuid: string): Promise<T | null>;
|
|
5
|
+
update(id: number, item: Partial<T>): Promise<T | null>;
|
|
6
|
+
delete(id: number): Promise<boolean>;
|
|
7
|
+
getAll(page: number, limit: number): Promise<IDataPaginator<T>>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IDataPaginator<T> {
|
|
11
|
+
success: boolean;
|
|
12
|
+
data: T[];
|
|
13
|
+
page: number;
|
|
14
|
+
limit: number;
|
|
15
|
+
count: number;
|
|
16
|
+
totalCount: number;
|
|
17
|
+
totalPages: number;
|
|
18
|
+
}
|
package/dist/templates/db-sql/src/dao/sundays-package-version/sundays-package-version.dao.ts
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import { Knex } from "knex";
|
|
2
|
-
import { IBaseDAO, IDataPaginator } from "../../d.types";
|
|
3
|
-
import { ISundaysPackageVersion } from "../../interfaces/sundays-package-version/sundays-package-version.interfaces";
|
|
4
|
-
import KnexManager from "../../KnexConnection";
|
|
5
|
-
|
|
6
|
-
export class SundaysPackageVersionDAO implements IBaseDAO<ISundaysPackageVersion> {
|
|
7
|
-
private _knex: Knex<any, unknown[]> = KnexManager.getConnection();
|
|
8
|
-
|
|
9
|
-
async create(item: ISundaysPackageVersion): Promise<ISundaysPackageVersion> {
|
|
10
|
-
const [created] = await this._knex("sundays_package_version").insert(item).returning("*");
|
|
11
|
-
return created;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async getById(id: number): Promise<ISundaysPackageVersion | null> {
|
|
15
|
-
const result = await this._knex("sundays_package_version")
|
|
16
|
-
.select("*")
|
|
17
|
-
.where("id", id)
|
|
18
|
-
.first();
|
|
19
|
-
return result || null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async getByUuid(uuid: string): Promise<ISundaysPackageVersion | null> {
|
|
23
|
-
const result = await this._knex("sundays_package_version")
|
|
24
|
-
.select("*")
|
|
25
|
-
.where("uuid", uuid)
|
|
26
|
-
.first();
|
|
27
|
-
return result || null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async update(id: number, item: Partial<ISundaysPackageVersion>): Promise<ISundaysPackageVersion | null> {
|
|
31
|
-
const [updated] = await this._knex("sundays_package_version")
|
|
32
|
-
.where({ id })
|
|
33
|
-
.update(item)
|
|
34
|
-
.returning("*");
|
|
35
|
-
return updated || null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async delete(id: number): Promise<boolean> {
|
|
39
|
-
const result = await this._knex("sundays_package_version").where({ id }).del();
|
|
40
|
-
return result > 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async getAll(page: number, limit: number): Promise<IDataPaginator<ISundaysPackageVersion>> {
|
|
44
|
-
const safeLimit = Math.max(limit, 1);
|
|
45
|
-
const offset = (page - 1) * safeLimit;
|
|
46
|
-
|
|
47
|
-
const query = this._knex("sundays_package_version").select("*");
|
|
48
|
-
|
|
49
|
-
const [countResult] = await query.clone().clearSelect().count("* as count");
|
|
50
|
-
const totalCount = +countResult.count;
|
|
51
|
-
const data = await query.clone().limit(safeLimit).offset(offset).orderBy("id", "desc");
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
success: true,
|
|
55
|
-
data,
|
|
56
|
-
page,
|
|
57
|
-
limit: safeLimit,
|
|
58
|
-
count: data.length,
|
|
59
|
-
totalCount,
|
|
60
|
-
totalPages: Math.ceil(totalCount / safeLimit),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async getLatestVersion(): Promise<ISundaysPackageVersion | null> {
|
|
65
|
-
const result = await this._knex("sundays_package_version")
|
|
66
|
-
.select("*")
|
|
67
|
-
.orderBy("id", "desc")
|
|
68
|
-
.first();
|
|
69
|
-
return result || null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
import { Knex } from "knex";
|
|
2
|
+
import { IBaseDAO, IDataPaginator } from "../../d.types";
|
|
3
|
+
import { ISundaysPackageVersion } from "../../interfaces/sundays-package-version/sundays-package-version.interfaces";
|
|
4
|
+
import KnexManager from "../../KnexConnection";
|
|
5
|
+
|
|
6
|
+
export class SundaysPackageVersionDAO implements IBaseDAO<ISundaysPackageVersion> {
|
|
7
|
+
private _knex: Knex<any, unknown[]> = KnexManager.getConnection();
|
|
8
|
+
|
|
9
|
+
async create(item: ISundaysPackageVersion): Promise<ISundaysPackageVersion> {
|
|
10
|
+
const [created] = await this._knex("sundays_package_version").insert(item).returning("*");
|
|
11
|
+
return created;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async getById(id: number): Promise<ISundaysPackageVersion | null> {
|
|
15
|
+
const result = await this._knex("sundays_package_version")
|
|
16
|
+
.select("*")
|
|
17
|
+
.where("id", id)
|
|
18
|
+
.first();
|
|
19
|
+
return result || null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async getByUuid(uuid: string): Promise<ISundaysPackageVersion | null> {
|
|
23
|
+
const result = await this._knex("sundays_package_version")
|
|
24
|
+
.select("*")
|
|
25
|
+
.where("uuid", uuid)
|
|
26
|
+
.first();
|
|
27
|
+
return result || null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async update(id: number, item: Partial<ISundaysPackageVersion>): Promise<ISundaysPackageVersion | null> {
|
|
31
|
+
const [updated] = await this._knex("sundays_package_version")
|
|
32
|
+
.where({ id })
|
|
33
|
+
.update(item)
|
|
34
|
+
.returning("*");
|
|
35
|
+
return updated || null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async delete(id: number): Promise<boolean> {
|
|
39
|
+
const result = await this._knex("sundays_package_version").where({ id }).del();
|
|
40
|
+
return result > 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async getAll(page: number, limit: number): Promise<IDataPaginator<ISundaysPackageVersion>> {
|
|
44
|
+
const safeLimit = Math.max(limit, 1);
|
|
45
|
+
const offset = (page - 1) * safeLimit;
|
|
46
|
+
|
|
47
|
+
const query = this._knex("sundays_package_version").select("*");
|
|
48
|
+
|
|
49
|
+
const [countResult] = await query.clone().clearSelect().count("* as count");
|
|
50
|
+
const totalCount = +countResult.count;
|
|
51
|
+
const data = await query.clone().limit(safeLimit).offset(offset).orderBy("id", "desc");
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
success: true,
|
|
55
|
+
data,
|
|
56
|
+
page,
|
|
57
|
+
limit: safeLimit,
|
|
58
|
+
count: data.length,
|
|
59
|
+
totalCount,
|
|
60
|
+
totalPages: Math.ceil(totalCount / safeLimit),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async getLatestVersion(): Promise<ISundaysPackageVersion | null> {
|
|
65
|
+
const result = await this._knex("sundays_package_version")
|
|
66
|
+
.select("*")
|
|
67
|
+
.orderBy("id", "desc")
|
|
68
|
+
.first();
|
|
69
|
+
return result || null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// DAOs
|
|
2
|
-
export { SundaysPackageVersionDAO } from "./dao/sundays-package-version/sundays-package-version.dao";
|
|
3
|
-
|
|
4
|
-
// Interfaces
|
|
5
|
-
export { IDataPaginator } from "./d.types";
|
|
6
|
-
export { ISundaysPackageVersion } from "./interfaces/sundays-package-version/sundays-package-version.interfaces";
|
|
7
|
-
|
|
8
|
-
import KnexManager from './KnexConnection';
|
|
9
|
-
export { KnexManager };
|
|
1
|
+
// DAOs
|
|
2
|
+
export { SundaysPackageVersionDAO } from "./dao/sundays-package-version/sundays-package-version.dao";
|
|
3
|
+
|
|
4
|
+
// Interfaces
|
|
5
|
+
export { IDataPaginator } from "./d.types";
|
|
6
|
+
export { ISundaysPackageVersion } from "./interfaces/sundays-package-version/sundays-package-version.interfaces";
|
|
7
|
+
|
|
8
|
+
import KnexManager from './KnexConnection';
|
|
9
|
+
export { KnexManager };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface ISundaysPackageVersion {
|
|
2
|
-
id: number;
|
|
3
|
-
versionName: string;
|
|
4
|
-
createdAt: string;
|
|
5
|
-
updatedAt: string;
|
|
6
|
-
}
|
|
1
|
+
export interface ISundaysPackageVersion {
|
|
2
|
+
id: number;
|
|
3
|
+
versionName: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
updatedAt: string;
|
|
6
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "CommonJS",
|
|
4
|
-
"target": "ES2022",
|
|
5
|
-
"sourceMap": true,
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"rootDir": "./src",
|
|
10
|
-
"outDir": "./dist",
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src/**/*"],
|
|
15
|
-
"exclude": ["node_modules", "dist"]
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "CommonJS",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"sourceMap": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"rootDir": "./src",
|
|
10
|
+
"outDir": "./dist",
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*"],
|
|
15
|
+
"exclude": ["node_modules", "dist"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
@import 'tw-animate-css';
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
--background: oklch(0.12 0.01 240);
|
|
8
|
+
--foreground: oklch(0.98 0 0);
|
|
9
|
+
--card: oklch(0.16 0.01 240);
|
|
10
|
+
--card-foreground: oklch(0.98 0 0);
|
|
11
|
+
--popover: oklch(0.14 0.01 240);
|
|
12
|
+
--popover-foreground: oklch(0.98 0 0);
|
|
13
|
+
--primary: oklch(0.65 0.18 145);
|
|
14
|
+
--primary-foreground: oklch(0.12 0.01 240);
|
|
15
|
+
--secondary: oklch(0.22 0.01 240);
|
|
16
|
+
--secondary-foreground: oklch(0.85 0 0);
|
|
17
|
+
--muted: oklch(0.20 0.01 240);
|
|
18
|
+
--muted-foreground: oklch(0.55 0 0);
|
|
19
|
+
--accent: oklch(0.50 0.15 200);
|
|
20
|
+
--accent-foreground: oklch(0.98 0 0);
|
|
21
|
+
--destructive: oklch(0.55 0.22 25);
|
|
22
|
+
--destructive-foreground: oklch(0.98 0 0);
|
|
23
|
+
--border: oklch(0.25 0.01 240);
|
|
24
|
+
--input: oklch(0.18 0.01 240);
|
|
25
|
+
--ring: oklch(0.65 0.18 145);
|
|
26
|
+
--chart-1: oklch(0.65 0.18 145);
|
|
27
|
+
--chart-2: oklch(0.50 0.15 200);
|
|
28
|
+
--chart-3: oklch(0.55 0.22 25);
|
|
29
|
+
--chart-4: oklch(0.70 0.15 80);
|
|
30
|
+
--chart-5: oklch(0.60 0.20 280);
|
|
31
|
+
--radius: 0.75rem;
|
|
32
|
+
--sidebar: oklch(0.10 0.01 240);
|
|
33
|
+
--sidebar-foreground: oklch(0.98 0 0);
|
|
34
|
+
--sidebar-primary: oklch(0.65 0.18 145);
|
|
35
|
+
--sidebar-primary-foreground: oklch(0.12 0.01 240);
|
|
36
|
+
--sidebar-accent: oklch(0.18 0.01 240);
|
|
37
|
+
--sidebar-accent-foreground: oklch(0.98 0 0);
|
|
38
|
+
--sidebar-border: oklch(0.22 0.01 240);
|
|
39
|
+
--sidebar-ring: oklch(0.65 0.18 145);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dark {
|
|
43
|
+
--background: oklch(0.12 0.01 240);
|
|
44
|
+
--foreground: oklch(0.98 0 0);
|
|
45
|
+
--card: oklch(0.16 0.01 240);
|
|
46
|
+
--card-foreground: oklch(0.98 0 0);
|
|
47
|
+
--popover: oklch(0.14 0.01 240);
|
|
48
|
+
--popover-foreground: oklch(0.98 0 0);
|
|
49
|
+
--primary: oklch(0.65 0.18 145);
|
|
50
|
+
--primary-foreground: oklch(0.12 0.01 240);
|
|
51
|
+
--secondary: oklch(0.22 0.01 240);
|
|
52
|
+
--secondary-foreground: oklch(0.85 0 0);
|
|
53
|
+
--muted: oklch(0.20 0.01 240);
|
|
54
|
+
--muted-foreground: oklch(0.55 0 0);
|
|
55
|
+
--accent: oklch(0.50 0.15 200);
|
|
56
|
+
--accent-foreground: oklch(0.98 0 0);
|
|
57
|
+
--destructive: oklch(0.55 0.22 25);
|
|
58
|
+
--destructive-foreground: oklch(0.98 0 0);
|
|
59
|
+
--border: oklch(0.25 0.01 240);
|
|
60
|
+
--input: oklch(0.18 0.01 240);
|
|
61
|
+
--ring: oklch(0.65 0.18 145);
|
|
62
|
+
--chart-1: oklch(0.65 0.18 145);
|
|
63
|
+
--chart-2: oklch(0.50 0.15 200);
|
|
64
|
+
--chart-3: oklch(0.55 0.22 25);
|
|
65
|
+
--chart-4: oklch(0.70 0.15 80);
|
|
66
|
+
--chart-5: oklch(0.60 0.20 280);
|
|
67
|
+
--sidebar: oklch(0.10 0.01 240);
|
|
68
|
+
--sidebar-foreground: oklch(0.98 0 0);
|
|
69
|
+
--sidebar-primary: oklch(0.65 0.18 145);
|
|
70
|
+
--sidebar-primary-foreground: oklch(0.12 0.01 240);
|
|
71
|
+
--sidebar-accent: oklch(0.18 0.01 240);
|
|
72
|
+
--sidebar-accent-foreground: oklch(0.98 0 0);
|
|
73
|
+
--sidebar-border: oklch(0.22 0.01 240);
|
|
74
|
+
--sidebar-ring: oklch(0.65 0.18 145);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@theme inline {
|
|
78
|
+
--font-sans: 'Geist', 'Geist Fallback';
|
|
79
|
+
--font-mono: 'Geist Mono', 'Geist Mono Fallback';
|
|
80
|
+
--color-background: var(--background);
|
|
81
|
+
--color-foreground: var(--foreground);
|
|
82
|
+
--color-card: var(--card);
|
|
83
|
+
--color-card-foreground: var(--card-foreground);
|
|
84
|
+
--color-popover: var(--popover);
|
|
85
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
86
|
+
--color-primary: var(--primary);
|
|
87
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
88
|
+
--color-secondary: var(--secondary);
|
|
89
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
90
|
+
--color-muted: var(--muted);
|
|
91
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
92
|
+
--color-accent: var(--accent);
|
|
93
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
94
|
+
--color-destructive: var(--destructive);
|
|
95
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
96
|
+
--color-border: var(--border);
|
|
97
|
+
--color-input: var(--input);
|
|
98
|
+
--color-ring: var(--ring);
|
|
99
|
+
--color-chart-1: var(--chart-1);
|
|
100
|
+
--color-chart-2: var(--chart-2);
|
|
101
|
+
--color-chart-3: var(--chart-3);
|
|
102
|
+
--color-chart-4: var(--chart-4);
|
|
103
|
+
--color-chart-5: var(--chart-5);
|
|
104
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
105
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
106
|
+
--radius-lg: var(--radius);
|
|
107
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
108
|
+
--color-sidebar: var(--sidebar);
|
|
109
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
110
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
111
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
112
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
113
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
114
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
115
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@layer base {
|
|
119
|
+
* {
|
|
120
|
+
@apply border-border outline-ring/50;
|
|
121
|
+
}
|
|
122
|
+
body {
|
|
123
|
+
@apply bg-background text-foreground;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import { Geist, Geist_Mono } from 'next/font/google'
|
|
3
|
+
import { Analytics } from '@vercel/analytics/next'
|
|
4
|
+
import './globals.css'
|
|
5
|
+
|
|
6
|
+
const _geist = Geist({ subsets: ["latin"] });
|
|
7
|
+
const _geistMono = Geist_Mono({ subsets: ["latin"] });
|
|
8
|
+
|
|
9
|
+
export const metadata: Metadata = {
|
|
10
|
+
title: 'Project Generator - AI-Powered Scaffolding',
|
|
11
|
+
description: 'Generate complete project specifications and scaffolding with AI',
|
|
12
|
+
generator: 'v0.app',
|
|
13
|
+
icons: {
|
|
14
|
+
icon: [
|
|
15
|
+
{
|
|
16
|
+
url: '/icon-light-32x32.png',
|
|
17
|
+
media: '(prefers-color-scheme: light)',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
url: '/icon-dark-32x32.png',
|
|
21
|
+
media: '(prefers-color-scheme: dark)',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
url: '/icon.svg',
|
|
25
|
+
type: 'image/svg+xml',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
apple: '/apple-icon.png',
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default function RootLayout({
|
|
33
|
+
children,
|
|
34
|
+
}: Readonly<{
|
|
35
|
+
children: React.ReactNode
|
|
36
|
+
}>) {
|
|
37
|
+
return (
|
|
38
|
+
<html lang="en">
|
|
39
|
+
<body className="font-sans antialiased">
|
|
40
|
+
{children}
|
|
41
|
+
<Analytics />
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
|
44
|
+
)
|
|
45
|
+
}
|