Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix `create-org` and update readme (#328)

* fix create-org and update readme

* more readme changes

authored by

Dom Rettig and committed by
GitHub
0e3223d5 13f857b3

+24 -13
+7 -1
README.md
··· 49 49 (cd server && npm install) 50 50 (cd db && npm install) 51 51 ``` 52 - 3. Make sure the `.env` files for `/server` and `db` are populated (including ClickHouse credentials). Run database migrations: 52 + 3. Make sure the `.env` files for `/server` and `db` are populated (including ClickHouse credentials). Create databases and run migrations: 53 53 ```bash 54 + npm run db:create -- --env staging --db api-server-pg 55 + npm run db:create -- --env staging --db scylla 56 + npm run db:create -- --env staging --db clickhouse 57 + 54 58 npm run db:update -- --env staging --db api-server-pg 55 59 npm run db:update -- --env staging --db scylla 56 60 npm run db:update -- --env staging --db clickhouse ··· 77 81 5. Create an organization and admin user: 78 82 ```bash 79 83 npm run create-org 84 + 85 + 6. Run `cd server && npm run copy-assets` 80 86 ``` 81 87 82 88 Use the credentials provided to log in at `http://localhost:3000`.
+17 -12
server/bin/create-org-and-user.ts
··· 37 37 type: 'string', 38 38 demandOption: true, 39 39 description: 'Organization website URL', 40 + coerce: (value: string) => { 41 + if (!/^https?:\/\//i.test(value)) { 42 + return `https://${value}`; 43 + } 44 + return value; 45 + }, 40 46 }, 41 47 firstName: { 42 48 type: 'string', ··· 65 71 const orgId = uid(); 66 72 const userId = uid(); 67 73 68 - // Create signing keys 74 + // Create org first so FK-dependent tables can reference it 75 + const org = await kyselyOrgInsert({ 76 + db: container.KyselyPg, 77 + id: orgId, 78 + email: argv.email, 79 + name: argv.name, 80 + websiteUrl: argv.website, 81 + }); 82 + 83 + // Create signing keys and API key (both reference org via FK) 69 84 await container.SigningKeyPairService.createAndStoreSigningKeys(orgId); 70 85 71 - // Create API key 72 - const { apiKey: rawApiKey, record: apiKeyRecord } = 86 + const { apiKey: rawApiKey } = 73 87 await container.ApiKeyService.createApiKey( 74 88 orgId, 75 89 'Main API Key', 76 90 'Primary API key for organization', 77 91 null, 78 92 ); 79 - 80 - const org = await kyselyOrgInsert({ 81 - db: container.KyselyPg, 82 - id: orgId, 83 - email: argv.email, 84 - name: argv.name, 85 - websiteUrl: argv.website, 86 - apiKeyId: apiKeyRecord.id, 87 - }); 88 93 89 94 // Initialize org settings 90 95 await Promise.all([