brackets-drizzle-db 2.1.0 → 2.1.1
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.
|
@@ -36,6 +36,23 @@ export declare const tournament: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
36
36
|
identity: undefined;
|
|
37
37
|
generated: undefined;
|
|
38
38
|
}, {}, {}>;
|
|
39
|
+
slug: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "slug";
|
|
41
|
+
tableName: "Tournament";
|
|
42
|
+
dataType: "string";
|
|
43
|
+
columnType: "PgText";
|
|
44
|
+
data: string;
|
|
45
|
+
driverParam: string;
|
|
46
|
+
notNull: true;
|
|
47
|
+
hasDefault: false;
|
|
48
|
+
isPrimaryKey: false;
|
|
49
|
+
isAutoincrement: false;
|
|
50
|
+
hasRuntimeDefault: false;
|
|
51
|
+
enumValues: [string, ...string[]];
|
|
52
|
+
baseColumn: never;
|
|
53
|
+
identity: undefined;
|
|
54
|
+
generated: undefined;
|
|
55
|
+
}, {}, {}>;
|
|
39
56
|
description: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
57
|
name: "description";
|
|
41
58
|
tableName: "Tournament";
|
|
@@ -10,6 +10,8 @@ exports.tournament = (0, pg_core_1.pgTable)('Tournament', {
|
|
|
10
10
|
id: (0, pg_core_1.text)('id').primaryKey(),
|
|
11
11
|
// Name of the tournament
|
|
12
12
|
name: (0, pg_core_1.text)('name').notNull(),
|
|
13
|
+
// URL-friendly slug for the tournament
|
|
14
|
+
slug: (0, pg_core_1.text)('slug').notNull(),
|
|
13
15
|
// Description of the tournament
|
|
14
16
|
description: (0, pg_core_1.text)('description'),
|
|
15
17
|
// Start date of the tournament
|
|
@@ -3,6 +3,7 @@ import type { JsonValue } from '../../types';
|
|
|
3
3
|
export type Tournament = {
|
|
4
4
|
id: string;
|
|
5
5
|
name: string;
|
|
6
|
+
slug: string;
|
|
6
7
|
description: string | null;
|
|
7
8
|
start_date: Date | null;
|
|
8
9
|
end_date: Date | null;
|
|
@@ -10,6 +11,7 @@ export type Tournament = {
|
|
|
10
11
|
};
|
|
11
12
|
type TournamentInput = {
|
|
12
13
|
name: string;
|
|
14
|
+
slug?: string;
|
|
13
15
|
description?: string | null;
|
|
14
16
|
start_date?: Date | string | null;
|
|
15
17
|
end_date?: Date | string | null;
|
|
@@ -18,6 +20,7 @@ type TournamentInput = {
|
|
|
18
20
|
export declare const TournamentTransformer: {
|
|
19
21
|
to(input: TournamentInput): {
|
|
20
22
|
name: string;
|
|
23
|
+
slug: string;
|
|
21
24
|
description: string | null;
|
|
22
25
|
startDate: Date | null;
|
|
23
26
|
endDate: Date | null;
|
|
@@ -16,10 +16,17 @@ function normalizeExtra(extra) {
|
|
|
16
16
|
}
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
|
+
function generateSlug(name) {
|
|
20
|
+
return name
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
23
|
+
.replace(/^-|-$/g, '');
|
|
24
|
+
}
|
|
19
25
|
exports.TournamentTransformer = {
|
|
20
26
|
to(input) {
|
|
21
27
|
return {
|
|
22
28
|
name: input.name,
|
|
29
|
+
slug: input.slug ?? generateSlug(input.name),
|
|
23
30
|
description: input.description ?? null,
|
|
24
31
|
startDate: parseDate(input.start_date),
|
|
25
32
|
endDate: parseDate(input.end_date),
|
|
@@ -30,6 +37,7 @@ exports.TournamentTransformer = {
|
|
|
30
37
|
return {
|
|
31
38
|
id: output.id,
|
|
32
39
|
name: output.name,
|
|
40
|
+
slug: output.slug,
|
|
33
41
|
description: output.description,
|
|
34
42
|
start_date: output.startDate,
|
|
35
43
|
end_date: output.endDate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brackets-drizzle-db",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "A SQL database with Drizzle ORM for brackets-manager.js",
|
|
5
5
|
"author": "Tandashi",
|
|
6
6
|
"license": "ISC",
|
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"drizzle",
|
|
28
28
|
"sql"
|
|
29
29
|
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"prepare": "pnpm run build",
|
|
33
|
+
"prepublishOnly": "pnpm run build"
|
|
34
|
+
},
|
|
30
35
|
"dependencies": {
|
|
31
36
|
"brackets-model": "^1.6.0",
|
|
32
37
|
"drizzle-orm": "^0.38.3",
|
|
@@ -38,8 +43,5 @@
|
|
|
38
43
|
},
|
|
39
44
|
"peerDependencies": {
|
|
40
45
|
"brackets-manager": "1.x"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsc"
|
|
44
46
|
}
|
|
45
|
-
}
|
|
47
|
+
}
|