Amplify
7 |Learn. Support. Put it in print.
8 |13 | Choose a cause to reach out to your representative for the Climate Can’t 14 | Wait Campaign 2022. 15 |
16 |17 | 30 advocacy orgs across New York are pushing a historic package that can 18 | drastically address climate change. Your assignment? Make sure you get 19 | the word out, we’ll handle post. 20 |
5 | Other people are also engaging with {{ repName }} on these causes. 6 |
7 | 8 |
18 |
--------------------------------------------------------------------------------
/server/db/migrations/20211230165803_harden-campaigns-table.js:
--------------------------------------------------------------------------------
1 | const tableName = 'campaigns'
2 |
3 | module.exports = {
4 | async up(knex) {
5 | // Alter the table
6 | await knex.schema.alterTable(tableName, function (table) {
7 | // Add NOT NULL constraints to simple fields
8 | table.string('name').notNullable().alter()
9 | table.string('organization').notNullable().alter()
10 | table.integer('letters_counter').notNullable().alter()
11 |
12 | // Change type from string to text and add NOT NULL constraint
13 | table.text('page_url').notNullable().alter()
14 |
15 | // Change type from string to native enum types
16 | table
17 | .enum('cause', ['Civic Rights', 'Education', 'Climate Justice'], {
18 | useNative: true,
19 | enumName: 'cause_type'
20 | })
21 | .notNullable()
22 | .alter()
23 |
24 | table
25 | .enum('type', ['Starter', 'Accelerator', 'Grant'], {
26 | useNative: true,
27 | enumName: 'campaign_type'
28 | })
29 | .notNullable()
30 | .alter()
31 |
32 | // Add indexes
33 | table.index(['name'])
34 | table.index(['organization'])
35 |
36 | // Add unique indexes
37 | table.unique(['name', 'organization'])
38 | })
39 | },
40 |
41 | async down(knex) {
42 | // Alter the table
43 | await knex.schema.alterTable(tableName, function (table) {
44 | // Drop unique indexes
45 | table.dropUnique(['name', 'organization'])
46 |
47 | // Drop indexes
48 | table.dropIndex(['organization'])
49 | table.dropIndex(['name'])
50 |
51 | // Drop NOT NULL constraints from simple fields
52 | table.string('name').nullable().alter()
53 | table.string('organization').nullable().alter()
54 | table.integer('letters_counter').nullable().alter()
55 |
56 | // Change type from text to string and drop NOT NULL constraint
57 | table.string('page_url').nullable().alter()
58 |
59 | // Change type from native enum to string and drop NOT NULL constraint
60 | table.string('cause').nullable().alter()
61 | table.string('type').nullable().alter()
62 | })
63 |
64 | // Manually remove the native enum types
65 | await knex.raw(`DROP TYPE IF EXISTS cause_type;`)
66 | await knex.raw(`DROP TYPE IF EXISTS campaign_type;`)
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/server/__tests__/integration/axios-cache-interceptor.test.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config()
2 | const Axios = require('axios')
3 | const { setupCache } = require('axios-cache-interceptor')
4 |
5 | // 1. we test that the configuration we set is valid and available to check
6 | describe('test Axios configuration', () => {
7 | test('tests argument composition', () => {
8 | const axios = Axios.create()
9 | const withAxios = setupCache(axios)
10 | // we expect axios to be properly configured with setupCache
11 | expect(withAxios).not.toBeUndefined()
12 |
13 | // we expect the cache to be properly configured and contain our properties after initialization
14 | const withConfig = setupCache(axios, { ttl: 1234 })
15 | expect(withConfig).not.toBeUndefined()
16 | expect(withConfig.defaults.cache.ttl).toBe(1234)
17 | })
18 | })
19 |
20 | // 2. we test that the cache is working as expected with concurrent requests
21 | describe('test Axios cache with two requests', () => {
22 | test('tests cache', async () => {
23 | const axios = Axios.create()
24 | const cache_interceptor = setupCache(axios)
25 |
26 | // we make two sequential requests to the same api endpoint
27 | const req1 = cache_interceptor.get('https://github.com/OpenSourceFellows/amplify')
28 | const req2 = cache_interceptor.get('https://github.com/OpenSourceFellows/amplify/')
29 | const res1 = await req1
30 | const res2 = await req2
31 |
32 | // assertions: we expect the second response to be cached
33 | expect(res1.cached).toBe(false)
34 | expect(res2.cached).toBe(true)
35 | })
36 | })
37 |
38 | // 3. we test that the cache is invalidated when the ttl expires
39 | describe('test Axios cache invalidation option', () => {
40 | test('tests cache invalidation', async () => {
41 | // we set the ttl to 10 seconds
42 | const axios = Axios.create()
43 | const cache_interceptor = setupCache(axios, { ttl: 10000 })
44 | // make a simple request
45 | await cache_interceptor.get('https://github.com/OpenSourceFellows/amplify')
46 | // wait for 11 seconds and make another call
47 | await new Promise((resolve) => setTimeout(() => resolve(), 11000))
48 | const res3 = await cache_interceptor.get('https://github.com/OpenSourceFellows/amplify')
49 | // assertions: the second request is expected not to be cached, due to the ttl
50 | expect(res3.cached).toBe(false)
51 | }, 70000)
52 | })
53 |
--------------------------------------------------------------------------------
/src/components/CampaignCards.vue:
--------------------------------------------------------------------------------
1 |
2 |
12 |
26 |
27 | - [Overall Project Board](https://github.com/ProgramEquity/amplify/projects?type=beta)
28 | - [Feature Breakdown](https://github.com/ProgramEquity/amplify/discussions/62)
29 | - [OSS Architecture](https://github.com/ProgramEquity/amplify/discussions/61)
30 | - [Wiki](https://github.com/ProgramEquity/amplify/wiki): API methods, Data Structures
31 |
32 | **Resources:**
33 | - We meet every **Wednesday from 12-1 p.m. PT and Thursdays from 8-8:30 p.m. PT**. Sign up for an [orientation](https://forms.gle/4miQJ8ccuWdeJha16)
34 | - Try out our [demo](https://www.figma.com/file/46c9cmuTiCpFA4DHB8OK0H/Amplify-User-Interface-%2B-Design-Guide?node-id=1585%3A653) or review [App Research](https://www.notion.so/programequity/Dare-to-Dream-Civic-Engagement-is-key-to-change-595ca4db3a2948c6b44569b58d530c8c)
35 |
36 | # Project setup
37 | In order to get started, you can clone, download a ZIP, or fork this repository to work on your local machine. If you would like to get started with Codespaces instead, the video below will walk you through setting up your Codespace.
38 |
39 | https://user-images.githubusercontent.com/9143339/159093687-6fc90733-0599-445c-b08b-a6378d988e4b.mov
40 |
41 | Codespaces Set Up
42 |
43 | ## Contributing
44 | Would you like to become a contributor? Please check out our [contributors guide](./CONTRIBUTING.md)! 💝
45 |
46 | Run the following script first:
47 | ```shell
48 | script/bootstrap
49 | ```
50 |
51 | You will need to copy the `.env.example` file to a `.env` file in this repo. You can use the following command in your terminal:
52 | ```shell
53 | cp .env.example .env
54 | ```
55 |
56 | ### Compiles and hot-reloads full app for development
57 | ```shell
58 | npm run dev
59 | ```
60 |
61 | ### Compiles and minifies for production
62 | ```shell
63 | npm run build
64 | ```
65 |
66 | ### Lints and fixes files
67 | ```shell
68 | npm run lint
69 | ```
70 |
71 | ### Runs Prettier and fixes files
72 | ```shell
73 | npm run format
74 | ```
75 |
76 | ### Build and run as if in prod
77 | ```shell
78 | npm start
79 | ```
80 |
81 | ### Customize configuration
82 | See [Configuration Reference](https://cli.vuejs.org/config/).
83 |
84 | # App Walkthrough
85 |
86 | **App Structure**
87 |
88 | Current Structure:
89 |
90 |