codidact / core Goto Github PK
View Code? Open in Web Editor NEWThe core Codidact Q&A software implementation
License: GNU Affero General Public License v3.0
The core Codidact Q&A software implementation
License: GNU Affero General Public License v3.0
As per - https://github.com/codidact/core/projects/1#card-31580308
an ORM needs to be implemented.
As decided in https://forum.codidact.org/t/what-kind-of-orm-should-we-use-in-the-project/549/18
the ORM of choice is going to be EF Core Code First.
Modify communities database migration file to use the CommunitiyStatus
enum directly, rather than simply a value of 1
. Currently in progress.
Is your feature request related to a problem? Please describe.
In the auth project upon registration a member has to be created. Thus it needs to signal to the core project to make such a member and return a result if successful so registration can be done.
Describe the solution you'd like
An API project that does the following:
Describe alternatives you've considered
Other than gRPC its easy to create a good old REST API. Problem is with so many microservices for instance a service for imports it might be better to use gRPC.
Is your feature request related to a problem? Please describe.
The question page details should display the questions and all relevant answers.
Thus an API for that is needed.
Describe the solution you'd like
Create a repository inside of application project called Questions and retrieve the necessary question details based on the question id received from the client.
Validate the request, return errors if not valid.
Should be authorized.
The project currently uses the Model-View-Controller (MVC) design pattern. It was decided (citation needed) to use Razor Pages instead.
Please note, that the src/Auth
project will be moved into a separate repository, therefor, this part of should be refactored later (?).
I think we need to have this before being able to work on posts and users:
https://github.com/codidact/core/projects/1#card-31579420
A system, which parses the URL, gets the community ID from it, verifies, whether that is in the DB and if it is, loads some information (name, tagline) into memory and passes that to the further controllers and views.
I'd do it, but I don't have enough knowledge in ASP.NET Core, so I'd like to ask for volunteers doing it. :)
Please reply here, when you can do this and I'll assign this task to you.
All the controllers and each of the actions in each of the controllers should go through an integration test to verify that they are working properly.
Requires:
Moved from codidact/authentication#5.
Refer to #62 (comment) .
I am not sure when this was introduced but the build is currently broken:
$ cd src/WebApp && dotnet run
fail: Microsoft.EntityFrameworkCore.Database.Command[20102]
Failed executing DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
CREATE TYPE audit.history_activity_type AS ENUM ('CREATE', 'UPDATE_BEFORE', 'UPDATE_AFTER', 'DELETE');
CREATE TYPE post_type AS ENUM ('question', 'answer', 'blog');
CREATE EXTENSION IF NOT EXISTS adminpack;
fail: Codidact.Core.WebApp.Startup[0]
Unable to apply database migrations. Check the connection string in your appsettings file.
crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
Application startup exception
Npgsql.PostgresException (0x80004005): 42501: permission denied to create extension "adminpack"
at Codidact.Core.WebApp.Startup.ApplyDatabaseMigrations(IApplicationBuilder app, ILogger logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 163
at Codidact.Core.WebApp.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger`1 logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 140
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
Exception data:
Severity: ERROR
SqlState: 42501
MessageText: permission denied to create extension "adminpack"
Hint: Must be superuser to create this extension.
File: extension.c
Line: 806
Routine: execute_extension_script
Unhandled exception. Npgsql.PostgresException (0x80004005): 42501: permission denied to create extension "adminpack"
at Codidact.Core.WebApp.Startup.ApplyDatabaseMigrations(IApplicationBuilder app, ILogger logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 163
at Codidact.Core.WebApp.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger`1 logger) in /home/me/dev/codidact/core/src/WebApp/Startup.cs:line 140
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Codidact.Core.WebApp.Program.Main(String[] args) in /home/me/dev/codidact/core/src/WebApp/Program.cs:line 13
at Codidact.Core.WebApp.Program.<Main>(String[] args)
Exception data:
Severity: ERROR
SqlState: 42501
MessageText: permission denied to create extension "adminpack"
Hint: Must be superuser to create this extension.
File: extension.c
Line: 806
Routine: execute_extension_script
I remember having a discussion somewhere, that some of the generated code referenced the "adminpack" extension somewhere. It is mentioned in some of the database migrations.
We should remove this from the migrations and find the cause of this issue.
Is your feature request related to a problem? Please describe.
The user should have an ability to create new questions in the question after filling out the new question page.
Thus an API for that is needed.
Describe the solution you'd like
Create a repository inside of application project called Questions and create a new question based on the data received from the client.
Validate the request, return errors if not valid.
Should be authorized.
Is your feature request related to a problem? Please describe.
Create a page that will display a list of questions.
Describe the solution you'd like
Please refer to:
https://github.com/codidact/feature-development/blob/master/scoped/browse/question-list.md
https://github.com/codidact/docs/wiki/Functional-Specification
As per c7dd9d8 currently the execution of the migration is execute via a cli command.
Rather than that, this line of code should be added somewhere on start:
dbContext.Database.Migrate()
Exception handling for this should also be implemented since there is no proper connection string.
As per discussion on the forum: https://forum.codidact.org/t/audit-tables-round-2/548/11
each entity in our database should have an additional table to represent its changes and audit.
May want to use the library of Audit.NET https://github.com/thepirat000/Audit.NET/tree/master/src/Audit.EntityFramework
Should be properly represented in the migration as well.
Since the project is using secrets, the Client Secret for the authentication should be managed by the secrets as well.
An instruction on how to do this should be added to:
https://github.com/codidact/core/blob/develop/docs/linux-instructions.md
https://github.com/codidact/core/blob/develop/docs/windows-instructions.md
The client secret placeholder can also be removed from https://github.com/codidact/core/blob/develop/src/WebUI/appsettings.json
The infrastructure project references a package that belongs to the ".NET Framework" framework, not to the ".NET Core" framework, namely Microsoft.AspNet.Identity.EntityFramework
.
In another place the package Microsoft.AspNetCore.Http.Abstractions
is included, it appears that this package was replaced by a "framework reference" whatever that is. I have not tested that but look dotnet/aspnetcore#6040 for details.
Is your feature request related to a problem? Please describe.
Create Shared Page layout that will be shared among all the pages.
Header, footer, sidebar.
Describe the solution you'd like
Should be implemented here:
https://github.com/codidact/core/blob/develop/src/WebApp/Pages/Shared/_Layout.cshtml
The SSL Labs result for Codidact shows that TLS 1.1 (deprecated) is supported and that HSTS is not.
The website "grade" given by SSL Labs (currently "A") will soon be capped at "B" due to support of TLS 1.1.
The website needs to support HSTS to get a grade of "A+".
I ask because for the past few months I've been looking at AskBot, which is used by the LibreOffice Q&A site.
From askbot.com:
Askbot is a free open source Question and Answer (Q&A) forum software written in Django and Python.
And also their documentation starts with:
Askbot is an open source Question and Answer (Q&A) forum project inspired by StackOverflow and YahooAnswers
Finally, AskBot is licensed as GPL3 and their code is on GitHub.
Is your feature request related to a problem? Please describe.
The questions page should display all relevant questions.
Thus an API for that is needed.
Describe the solution you'd like
Create a repository inside of application project called Questions and retrieve the necessary questions based on the filters given from the client.
Validate the request, return errors if not valid.
Should be authorized.
Currently, a copy of the Codesign implementation sits in src/WebUI/wwwroot/lib/co-design
. This should be a submodule, or maybe a subtree worktree?
I'm on it.
Can we please use ActivityPub to make the software decentralized? Why have "100" isolated servers (with redundant content) when we can have one network comprised of "100" federating instances (servers).
Describe the bug
In windows-instructions.md, it says:
- Run the following command inside of 'src/WebUI' to install the connection string
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "YOUR_CONNECTION_STRING"
but the src/WebUI folder does not exist in the current source tree.
The same problem exists in the Linux setup documentation.
Apply https://forum.codidact.org/t/what-software-license-should-we-use/205/29.
Cheers & good luck!
Currently the connection strings are stored in the appsettings.json
files. There is also a built in mechanism to store user secrets.
Essentially, it would look like this:
cd src/WebUI
dotnet user-secrets init
dotnet user-secrets set ConnectionStrings:DefaultConnection "Host=localhost;Database=codidact;Username=codidact"
This could also simplify the install instructions in #31.
It's not a must-have but I found that and would like to put it up for debate.
Is your feature request related to a problem? Please describe.
Create a page that will display a question and its answers with all of the details.
Describe the solution you'd like
Please refer to:
https://github.com/codidact/feature-development/blob/master/scoped/browse/view-question.md
https://github.com/codidact/docs/wiki/Functional-Specification
Per the forum thread https://forum.codidact.org/t/please-bake-in-localization-from-the-beginning/605 we should "bake in localization".
Dotnet supports this as part of its framework:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-3.1
Should at least create a Resources file and implement a standard of using it.
Note: Auth project should have this issue too
Is your feature request related to a problem? Please describe.
Setup instructions require us to use the dotnet-ef tool globally. This wasn't a problem pre-3.0 since the EF version was tied to the SDK version in global.json
. It's not anymore and different developer machines could end up with tool versions eventually.
Describe the solution you'd like
The tool should be installed locally for the project instead, so that there's a guarantee that every developer ends up using the same local tool version.
Refer to #55.
A lot of the values in that configuration are the default anyway, in my opinion we should use the defaults and then discuss which options should be turned on / off.
We should have a linter in the project to make it easy for folks to automatically fix their code to the style guide.
Style guide here: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions
Whatever we choose, we'll need to configure it for those settings.
Is your feature request related to a problem? Please describe.
The user should have an ability to create a new answer after filling out the new answer body.
Thus an API for that is needed.
Describe the solution you'd like
Create a repository inside of application project called Answers and create the answer based on the data received from the client.
Validate the request, return errors if not valid.
Should be authorized.
@DoctaJonez made the suggestion to rename the root namespace to match the recommended naming convention.
There was some discussion about this and the consensus was to rename the root namespace (citation needed).
Therefor, the namespaces should start with Codidact.Core.*
(?).
This tasks refers to how in this project data should be queried from.
This flow should be universal and used for all the queries.
It can be:
Feel free to add.
(I realize there is no forum thread about this but I feel its too technical to post on the forum)
As per https://forum.codidact.org/t/what-kind-of-authorization-framework-library-should-we-use/642/7 it has been decided upon IdentityServer/Identity.NET
The following adjustments should be:
app.UseAuthentication();
app.UseIdentityServer();
app.UseAuthorization();
services.AddIdentityServer()
.AddApiAuthorization<ApplicationUser, ApplicationDbContext>();
The current link URL is set to https://codidact.org/forum/
, which results in a 404. The correct forum URL should be https://forum.codidact.org/
. I'm in the process of submitting a pull request with this change.
It's so annoying to see all the migration stuff in the diffs, apparently this can be configured in the .gitattributes
file.
https://thoughtbot.com/blog/github-diff-supression
I'll look into that.
The idea is to run an authentication server (that deals with user passwords, etc.) in it's own process for security reasons.
The authentication stuff — I mean the stuff in src/Auth
— should be moved into the authentication repository.
There must be some sort of API between the servers, as far as I know there wasn't a precise decision made yet.
The authentication stuff is mostly separate already, a direct copy won't be possible though, because this server would connect to a different database.
I already created my own repository and slowly start moving the stuff over, however, I don't have much time currently and likely won't be able to complete this in a reasonable amount of time.
Created from project card here
The README needs instructions for setup for various operating systems. These instructions will certainly need maintenance as the project evolves.
I'll be performing a from-scratch install on a Windows PC without C# development tools and noting steps as I go.
Why are we using ASP.NET 2.1 instead of the newest (3.1) ?
I tried opening Codidact using Mono, and got this error:
Project Codidact.Infrastructure is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project Codidact.Infrastructure supports: netstandard2.1 (.NETStandard,Version=v2.1)
Current setup instructions point to a Microsoft download of dotnet core for various flavours of linux, which doesn't include Arch Linux. Luckily, packages exist and can be installed by the Arch package manager, pacman
Instructions should be updated to include steps to install on Arch Linux
I have added instructions to readme.md. PR coming.
Typo in the project README. In the process of creating pull request.
The privacy policy page is currently empty. I'm currently working on populating the page with the privacy policy from the forum.
There is currently no registration page for the site. I am currently working on implementing it.
Welcome to the Codidact project. We are glad, that you want to contribute to the software. See core/CONTRIBUTING.md for more information, on what kind of contributions are most helpful.
There is a list of open tasks at the bottom of this issue. See through them to find out, what you want to do. Completed tasks will be removed, tasks with a checked box are already assigned. Choose one and write a reply to this issue, saying that you want to claim it.
Claiming an issue means, that you have some responsibility. While this is an open-source project and nobody is paid for their work, we do expect tasks which have been claimed to be completed in a reasonable time. If you suddenly can’t continue, we’d be very glad, if you could give us notice and to publish everything you have already done to save others work.
You should also give us regular feedback. We will host regular meetings on our Discord server. We’ll announce a day, on which the feedback should be given there, soon. For all these status updates, ping @StatusUpdates. Just ask in any channel that seems to be appropriate, if you have any questions.
Is your feature request related to a problem? Please describe.
Create a page for creating a new question
Describe the solution you'd like
Please refer to:
https://github.com/codidact/feature-development/blob/master/scoped/post/create-post.md
https://github.com/codidact/docs/wiki/Functional-Specification
The user should be able to add tags.
The user should be able to write a title of the question
The user should be able to write a body of a question with a rich editor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.