Skip to content

Commit 927119a

Browse files
committed
_
1 parent a8e43a5 commit 927119a

File tree

4 files changed

+31
-130
lines changed

4 files changed

+31
-130
lines changed

database/config.dart

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
import 'package:path/path.dart' as path;
2+
import 'package:pharaoh/pharaoh_next.dart';
23
import 'package:yaroorm/yaroorm.dart';
34

5+
enum AppEnvironment {
6+
local(),
7+
staging(),
8+
prod();
9+
10+
const AppEnvironment();
11+
12+
DatabaseConnection get dbCon => switch (this) {
13+
AppEnvironment.prod => DatabaseConnection(
14+
'prod',
15+
DatabaseDriverType.pgsql,
16+
port: env<int>('DB_PORT', 6543),
17+
host: env<String>('DB_HOST', ''),
18+
username: env<String>('DB_USERNAME', ''),
19+
password: env<String>('DB_PASSWORD', ''),
20+
database: env<String>('DB_DATABASE', ''),
21+
secure: true,
22+
),
23+
_ => DatabaseConnection('local', DatabaseDriverType.sqlite, database: path.absolute('database', 'db.sqlite')),
24+
};
25+
}
26+
427
// Database password: dYEQHjitxY53TMyH
528
// Database username: postgres.srzosrzaqllpicsemkup
629
// Database host: aws-0-us-east-1.pooler.supabase.com
730
// Database name: postgres
831

9-
// DatabaseConnection(
10-
// 'pg',
11-
// DatabaseDriverType.pgsql,
12-
// port: env<int>('DB_PORT', 6543),
13-
// host: env<String>('DB_HOST', ''),
14-
// username: env<String>('DB_USERNAME', ''),
15-
// password: env<String>('DB_PASSWORD', ''),
16-
// database: env<String>('DB_DATABASE', ''),
17-
// secure: true,
18-
// ),
19-
2032
@DB.useConfig
2133
final config = YaroormConfig(
22-
'test_db',
23-
connections: [
24-
DatabaseConnection('test_db', DatabaseDriverType.sqlite, database: path.absolute('database', 'db.sqlite')),
25-
],
34+
AppEnvironment.local.name,
35+
connections: AppEnvironment.values.map((e) => e.dbCon).toList(),
2636
);

lib/src/controllers/user_controller.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import 'package:pharaoh/pharaoh_next.dart';
33
import '../models/user.dart';
44

55
class UserController extends HTTPController {
6-
UserController();
7-
86
Future<Response> currentUser() async {
97
final user = request.auth as User;
108
return jsonResponse({'user': user.toJson()});

pubspec.lock

Lines changed: 5 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ packages:
2525
url: "https://pub.dev"
2626
source: hosted
2727
version: "6.4.1"
28-
ansi_regex:
29-
dependency: transitive
30-
description:
31-
name: ansi_regex
32-
sha256: ca4f2b24a85e797a1512e1d3fe34d5f8429648f78e2268b6a8b5628c8430e643
33-
url: "https://pub.dev"
34-
source: hosted
35-
version: "0.1.2"
36-
ansi_strip:
37-
dependency: transitive
38-
description:
39-
name: ansi_strip
40-
sha256: "9bb54e10962ac1de86b9b64a278a5b8965a28a2f741975eac7fe9fb0ebe1aaac"
41-
url: "https://pub.dev"
42-
source: hosted
43-
version: "0.1.1+1"
4428
ansi_styles:
4529
dependency: transitive
4630
description:
@@ -153,22 +137,6 @@ packages:
153137
url: "https://pub.dev"
154138
source: hosted
155139
version: "8.9.2"
156-
chalkdart:
157-
dependency: transitive
158-
description:
159-
name: chalkdart
160-
sha256: "0b7ec5c6a6bafd1445500632c00c573722bd7736e491675d4ac3fe560bbd9cfe"
161-
url: "https://pub.dev"
162-
source: hosted
163-
version: "2.2.1"
164-
characters:
165-
dependency: transitive
166-
description:
167-
name: characters
168-
sha256: "81269c8d3f45541082bfbb117bbc962cfc68b5197eb4c705a00db4ddf394e1c1"
169-
url: "https://pub.dev"
170-
source: hosted
171-
version: "1.3.1"
172140
charcode:
173141
dependency: transitive
174142
description:
@@ -185,14 +153,6 @@ packages:
185153
url: "https://pub.dev"
186154
source: hosted
187155
version: "2.0.3"
188-
cli_completion:
189-
dependency: transitive
190-
description:
191-
name: cli_completion
192-
sha256: "158deec74a75cdc69bce061645fea08f94190dd6833f988f517c2dfcb45e9117"
193-
url: "https://pub.dev"
194-
source: hosted
195-
version: "0.5.0"
196156
cli_launcher:
197157
dependency: transitive
198158
description:
@@ -201,14 +161,6 @@ packages:
201161
url: "https://pub.dev"
202162
source: hosted
203163
version: "0.3.1"
204-
cli_table:
205-
dependency: transitive
206-
description:
207-
name: cli_table
208-
sha256: "61b61c6dbfa248d8ec9c65b1d97d1ec1952482765563533087ec550405def016"
209-
url: "https://pub.dev"
210-
source: hosted
211-
version: "1.0.2"
212164
cli_util:
213165
dependency: transitive
214166
description:
@@ -297,14 +249,6 @@ packages:
297249
url: "https://pub.dev"
298250
source: hosted
299251
version: "4.2.0"
300-
east_asian_width:
301-
dependency: transitive
302-
description:
303-
name: east_asian_width
304-
sha256: a13c5487dab7ddbad48875789819f0ea38a61cbaaa3024ebe7b199521e6f5788
305-
url: "https://pub.dev"
306-
source: hosted
307-
version: "1.0.1"
308252
ed25519_edwards:
309253
dependency: transitive
310254
description:
@@ -313,22 +257,6 @@ packages:
313257
url: "https://pub.dev"
314258
source: hosted
315259
version: "0.3.1"
316-
emoji_regex:
317-
dependency: transitive
318-
description:
319-
name: emoji_regex
320-
sha256: "3a25dd4d16f98b6f76dc37cc9ae49b8511891ac4b87beac9443a1e9f4634b6c7"
321-
url: "https://pub.dev"
322-
source: hosted
323-
version: "0.0.5"
324-
equatable:
325-
dependency: transitive
326-
description:
327-
name: equatable
328-
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
329-
url: "https://pub.dev"
330-
source: hosted
331-
version: "2.0.5"
332260
ez_validator_dart:
333261
dependency: transitive
334262
description:
@@ -489,14 +417,6 @@ packages:
489417
url: "https://pub.dev"
490418
source: hosted
491419
version: "1.2.0"
492-
mason_logger:
493-
dependency: transitive
494-
description:
495-
name: mason_logger
496-
sha256: "1fdf5c76870eb6fc3611ed6fbae1973a3794abe581ea5e22e68af2f73c688b93"
497-
url: "https://pub.dev"
498-
source: hosted
499-
version: "0.2.16"
500420
matcher:
501421
dependency: transitive
502422
description:
@@ -857,14 +777,6 @@ packages:
857777
url: "https://pub.dev"
858778
source: hosted
859779
version: "1.4.0"
860-
string_width:
861-
dependency: transitive
862-
description:
863-
name: string_width
864-
sha256: "0ea481fbb6d5e2d70937fea303d8cc9296048da107dffeecf2acb675c8b47e7f"
865-
url: "https://pub.dev"
866-
source: hosted
867-
version: "0.1.5"
868780
synchronized:
869781
dependency: transitive
870782
description:
@@ -969,14 +881,6 @@ packages:
969881
url: "https://pub.dev"
970882
source: hosted
971883
version: "1.1.0"
972-
wcwidth:
973-
dependency: transitive
974-
description:
975-
name: wcwidth
976-
sha256: "4e68ce25701e56647cb305ab6d8c75fce5e5196227bcb6ba6886513ac36474c2"
977-
url: "https://pub.dev"
978-
source: hosted
979-
version: "0.0.4"
980884
web:
981885
dependency: transitive
982886
description:
@@ -1009,14 +913,6 @@ packages:
1009913
url: "https://pub.dev"
1010914
source: hosted
1011915
version: "1.2.1"
1012-
win32:
1013-
dependency: transitive
1014-
description:
1015-
name: win32
1016-
sha256: e5c39a90447e7c81cfec14b041cdbd0d0916bd9ebbc7fe02ab69568be703b9bd
1017-
url: "https://pub.dev"
1018-
source: hosted
1019-
version: "5.6.0"
1020916
yaml:
1021917
dependency: transitive
1022918
description:
@@ -1036,11 +932,10 @@ packages:
1036932
yaroorm:
1037933
dependency: "direct main"
1038934
description:
1039-
path: "."
1040-
ref: HEAD
1041-
resolved-ref: fec564dcbca6feee6ef8ae23a3bc4633c9b10b48
1042-
url: "https://github.com/codekeyz/yaroorm.git"
1043-
source: git
1044-
version: "0.0.2"
935+
name: yaroorm
936+
sha256: "72bdeab359fe63e11e90dbe5eb355ef6655a0777bf376e3c7d0e3ab1fc5d6fe6"
937+
url: "https://pub.dev"
938+
source: hosted
939+
version: "0.0.3"
1045940
sdks:
1046941
dart: ">=3.5.0 <4.0.0"

pubspec.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ dependencies:
1515
bcrypt: ^1.1.3
1616
http: ^1.1.2
1717
pharaoh: ^0.0.8
18-
yaroorm:
19-
git:
20-
url: https://github.com/codekeyz/yaroorm.git
18+
yaroorm: ^0.0.3
2119
collection: ^1.18.0
2220

2321
logger: ^2.0.2+1

0 commit comments

Comments
 (0)